Symfony Doctrine2通过(';prop';=>;数组(';value';)查找失败

Symfony Doctrine2通过(';prop';=>;数组(';value';)查找失败,symfony,doctrine-orm,Symfony,Doctrine Orm,有人能告诉我为什么这样不行吗: $this->doctrine ->getEntityManager( 'default' ) ->getRepository( '\myVendor\myBundle\Entity\myEntity' ) ->findBy( array( 'myProperty' => array( 'myValue' ) ) ); 而以下情况则是: $this->doctrine ->getE

有人能告诉我为什么这样不行吗:

$this->doctrine
     ->getEntityManager( 'default' )
     ->getRepository( '\myVendor\myBundle\Entity\myEntity' )
     ->findBy( array( 'myProperty' => array( 'myValue' ) ) );
而以下情况则是:

$this->doctrine
     ->getEntityManager( 'default' )
     ->getRepository( '\myVendor\myBundle\Entity\myEntity' )
     ->findBy( array( 'myProperty' => 'myValue' ) );
第一个查询值是数组,第二个查询值是字符串

这就是我得到的错误:

注意:未定义索引:myProperty in/home/developer/public_html/myProject/vendor/doctrine/lib/doctrine/ORM/Persisters/basicintypersister.php第1324行


这是一个bug吗?

这是因为条令\ORM\Persisters\basicentypersister所使用的条令\ORM\EntityRepository执行

foreach ($criteria as $field => $value) {
在执行findBy时

$criteria
是你的

array( 'myProperty' => 'myValue' )

因此,如果使用数组而不是“myValue”,它将无法正常工作。它不是设计用来这样使用的。

这是因为条令\ORM\Persisters\basicentypersister所使用的条令\ORM\EntityRepository执行

foreach ($criteria as $field => $value) {
在执行findBy时

$criteria
是你的

array( 'myProperty' => 'myValue' )

因此,如果使用数组而不是“myValue”,它将无法正常工作。它不是这样设计的。

使用数组作为值,您到底想做什么?我的意思是
'prop'=>数组('x')
-这应该做什么?我很确定finder方法只支持直接相等性检查通过使用数组作为值,您到底想做什么?我的意思是
'prop'=>数组('x')
-这应该做什么?我很确定finder方法只支持直接相等检查STHX很多!终于填补了一个错误,在信条吉拉网站,现在是解决了!很高兴它对您有所帮助:)@user846226-您是如何解决的?你愿意和我们分享吗?谢谢!终于填补了一个错误,在信条吉拉网站,现在是解决了!很高兴它对您有所帮助:)@user846226-您是如何解决的?你愿意和我们分享吗?