mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1713: Doctrine2 findBy( 'myFKAssociacionProperty' => array( 'foo' ) ); not working #2156
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Mar 17, 2012).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user sibok:
A Foo Entity has the following association:
which fails to query by the following method ( note the array of values in the findBy() ):
$this->doctrine->getEntityManager( 'default' )->getRepository( '\myVendor\myBundle\Entity\myEntity' )->findBy( array( 'myProperty' => array( 'myValue' ) ) );
Curioously that does work ( note it has no values array ):
$this->doctrine->getEntityManager( 'default' )->getRepository( '\myVendor\myBundle\Entity\myEntity' )->findBy( array( 'myProperty' => 'myValue' ) );
The error i get on the first query is:
Notice: Undefined index: myProperty in /home/developer/public_html/myProject/vendor/doctrine/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1324
Finally as workaround i went with:
$em->createQuery('SELECT uws FROM MyProject\Model\WebSite ws JOIN ws.domain WHERE ws.domain = (?) ');
//Here passed the array of parameters
and had no problems
@doctrinebot commented on GitHub (May 27, 2012):
Comment created by @beberlei:
This works with Doctrine 2.2.*, see test
2e79637be8You can pass an array of values and it will create a query:
SELECT * FROM Entity WHERE association_id IN (?) and use Doctrine\DBAL\Connection::PARAM_INT_ARRAY to build the query.
@doctrinebot commented on GitHub (May 27, 2012):
Issue was closed with resolution "Invalid"