我的FbUserEntity
ArrayCollection
多PageEntity
。
$fbUser->getPageLikes();
//will give back an array of many PageEntity classes:
object(stdClass)[1410]
public '__CLASS__' => string 'MyBundle\Entity\PageEntity' (length=41)
public 'id' => int 877
public 'fbId' => string '8245623462' (length=10)
public 'name' => string 'NBA' (length=3)
我有一系列facebookId,如:
array (size=2)
0 => string '8245623462' (length=10)
1 => string '1239653462' (length=10)
我想从$ PageEntity
获取fbUser
个实体,其中fbId
的{{1}}可以在另一个数组中找到(实际上我只需要任何数组项都可以在PageEntity
集合中找到。检查示例我做了以下代码:
PageEntity
执行时我收到错误消息:
/* @var FbUserEntity $fbUser */
$uLikes = $fbUser->getPageLikes();
$criteria = Criteria::create()
->where(Criteria::expr()->in("fbId", $qLikes))
->setMaxResults(1);
$preferred = $uLikes->matching($criteria);
有趣的是An exception occurred while executing 'SELECT te.id AS id, te.fbId AS fbId, te.name AS name FROM Page te JOIN Page_Like t ON t.page = te.id WHERE t.user = ? AND te.fbId = ?' with params [22, ["8245623462","1239653462"]]:
Notice: Array to string conversion
期望参数2是一个数组,它是。另一件事是内部查询不应该使用Criteria::expr()->in()
而不是AND te.fbId IN (?)
吗?