コード例 #1
0
ファイル: LazyLoadingTest.php プロジェクト: nxpthx/FLOW3
 /**
  * @test
  */
 public function aopIsCorrectlyInitializedEvenIfADoctrineProxyGetsInitializedOnTheFlyFromTheOutside()
 {
     $entity = new TestEntity();
     $entity->setName('Andi');
     $relatedEntity = new TestEntity();
     $relatedEntity->setName('Robert');
     $entity->setRelatedEntity($relatedEntity);
     $this->testEntityRepository->add($entity);
     $this->testEntityRepository->add($relatedEntity);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $entityIdentifier = $this->persistenceManager->getIdentifierByObject($entity);
     $loadedEntity = $this->testEntityRepository->findByIdentifier($entityIdentifier);
     $this->testEntityRepository->findOneByName('Robert');
     $loadedRelatedEntity = $loadedEntity->getRelatedEntity();
     $this->assertEquals($loadedRelatedEntity->sayHello(), 'Hello Andi!');
 }