3 namespace Doctrine\Tests\ORM\Functional\Ticket;
5 use Doctrine\Tests\Models\CMS\CmsArticle;
6 use Doctrine\Tests\Models\CMS\CmsComment;
8 require_once __DIR__ . '/../../../TestInit.php';
10 class DDC812Test extends \Doctrine\Tests\OrmFunctionalTestCase
12 protected function setUp()
14 $this->useModelSet('cms');
21 public function testFetchJoinInitializesPreviouslyUninitializedCollectionOfManagedEntity()
23 //$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
24 $article = new CmsArticle;
25 $article->topic = "hello";
26 $article->text = "talk talk talk";
28 $comment = new CmsComment;
29 $comment->topic = "good!";
30 $comment->text = "stuff!";
31 $comment->article = $article;
33 $this->_em->persist($article);
34 $this->_em->persist($comment);
38 $article2 = $this->_em->find(get_class($article), $article->id);
40 $article2Again = $this->_em->createQuery(
41 "select a, c from Doctrine\Tests\Models\CMS\CmsArticle a join a.comments c where a.id = ?1")
42 ->setParameter(1, $article->id)
45 $this->assertTrue($article2Again === $article2);
46 $this->assertTrue($article2Again->comments->isInitialized());