public function testIssue()
 {
     //setup
     $phrase = new Phrase();
     $phrase->setPhrase('lalala');
     $type = new PhraseType();
     $type->setType('nonsense');
     $type->setAbbreviation('non');
     $def1 = new Definition();
     $def1->setDefinition('def1');
     $def2 = new Definition();
     $def2->setDefinition('def2');
     $phrase->setType($type);
     $phrase->addDefinition($def1);
     $phrase->addDefinition($def2);
     $this->_em->persist($phrase);
     $this->_em->persist($type);
     $this->_em->flush();
     $this->_em->clear();
     //end setup
     // test1 - lazy-loading many-to-one after find()
     $phrase2 = $this->_em->find('Doctrine\\Tests\\ORM\\Functional\\Phrase', $phrase->getId());
     $this->assertTrue(is_numeric($phrase2->getType()->getId()));
     $this->_em->clear();
     // test2 - eager load in DQL query
     $query = $this->_em->createQuery("SELECT p,t FROM Doctrine\\Tests\\ORM\\Functional\\Phrase p JOIN p.type t");
     $res = $query->getResult();
     $this->assertEquals(1, count($res));
     $this->assertInstanceOf('Doctrine\\Tests\\ORM\\Functional\\PhraseType', $res[0]->getType());
     $this->assertInstanceOf('Doctrine\\ORM\\PersistentCollection', $res[0]->getType()->getPhrases());
     $this->assertFalse($res[0]->getType()->getPhrases()->isInitialized());
     $this->_em->clear();
     // test2 - eager load in DQL query with double-join back and forth
     $query = $this->_em->createQuery("SELECT p,t,pp FROM Doctrine\\Tests\\ORM\\Functional\\Phrase p JOIN p.type t JOIN t.phrases pp");
     $res = $query->getResult();
     $this->assertEquals(1, count($res));
     $this->assertInstanceOf('Doctrine\\Tests\\ORM\\Functional\\PhraseType', $res[0]->getType());
     $this->assertInstanceOf('Doctrine\\ORM\\PersistentCollection', $res[0]->getType()->getPhrases());
     $this->assertTrue($res[0]->getType()->getPhrases()->isInitialized());
     $this->_em->clear();
     // test3 - lazy-loading one-to-many after find()
     $phrase3 = $this->_em->find('Doctrine\\Tests\\ORM\\Functional\\Phrase', $phrase->getId());
     $definitions = $phrase3->getDefinitions();
     $this->assertInstanceOf('Doctrine\\ORM\\PersistentCollection', $definitions);
     $this->assertInstanceOf('Doctrine\\Tests\\ORM\\Functional\\Definition', $definitions[0]);
     $this->_em->clear();
     // test4 - lazy-loading after DQL query
     $query = $this->_em->createQuery("SELECT p FROM Doctrine\\Tests\\ORM\\Functional\\Phrase p");
     $res = $query->getResult();
     $definitions = $res[0]->getDefinitions();
     $this->assertEquals(1, count($res));
     $this->assertInstanceOf('Doctrine\\Tests\\ORM\\Functional\\Definition', $definitions[0]);
     $this->assertEquals(2, $definitions->count());
 }