Created
December 8, 2011 07:29
-
-
Save cakper/1446386 to your computer and use it in GitHub Desktop.
Doctrine not working eager loading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = $em->createQuery('SELECT t FROM JazzyTransactionBundle:MoneyTransaction t WHERE t.sender = :user')->setParameter('user', $user); | |
$query->setFetchMode("JazzyTransactionBundle:MoneyTransaction", "sender", "EAGER"); | |
$transactions = $query->execute(); | |
WORKING: | |
<?php | |
$query = $em->createQuery('SELECT t FROM JazzyTransactionBundle:MoneyTransaction t WHERE t.sender = :user')->setParameter('user', $user); | |
$query->setFetchMode("Jazzy\TransactionBundle\Entity\MoneyTransaction", "sender", \Doctrine\ORM\Mapping\ClassMetadata::FETCH_EAGER); | |
$transactions = $query->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@vetalt: Thank you, Sir! This trolled me for a littel while.