Neos\Flow\Tests\Functional\Persistence\Fixtures\EntityWithIndexedRelation::getAnnotatedIdentitiesEntities PHP Method

getAnnotatedIdentitiesEntities() public method

public getAnnotatedIdentitiesEntities ( ) : Doctrine\Common\Collections\Collection
return Doctrine\Common\Collections\Collection
    public function getAnnotatedIdentitiesEntities()
    {
        return $this->annotatedIdentitiesEntities;
    }

Usage Example

 /**
  * This tests calls two indexed Relations and ensure that indexes are restored after fetching from persistence
  *
  * @test
  */
 public function collectionsWithIndexAttributeAreIndexed()
 {
     $entityWithIndexedRelation = new Fixtures\EntityWithIndexedRelation();
     for ($i = 0; $i < 3; $i++) {
         $annotatedIdentitiesEntity = new Fixtures\AnnotatedIdentitiesEntity();
         $annotatedIdentitiesEntity->setAuthor('Author' . (string) $i);
         $annotatedIdentitiesEntity->setTitle('Author' . (string) $i);
         $entityWithIndexedRelation->getAnnotatedIdentitiesEntities()->add($annotatedIdentitiesEntity);
     }
     $entityWithIndexedRelation->setRelatedIndexEntity('test', new Fixtures\RelatedIndexEntity());
     $this->persistenceManager->add($entityWithIndexedRelation);
     $this->persistenceManager->persistAll();
     $id = $this->persistenceManager->getIdentifierByObject($entityWithIndexedRelation);
     // Reset persistence manager to make sure fresh instances will be created
     $this->persistenceManager->clearState();
     unset($entityWithIndexedRelation);
     $entityWithIndexedRelation = $this->persistenceManager->getObjectByIdentifier($id, Fixtures\EntityWithIndexedRelation::class);
     for ($i = 0; $i < 3; $i++) {
         $this->assertArrayHasKey('Author' . (string) $i, $entityWithIndexedRelation->getAnnotatedIdentitiesEntities());
     }
     $this->assertArrayNotHasKey(0, $entityWithIndexedRelation->getAnnotatedIdentitiesEntities());
     $this->assertArrayHasKey('test', $entityWithIndexedRelation->getRelatedIndexEntities());
     $this->assertArrayNotHasKey(0, $entityWithIndexedRelation->getRelatedIndexEntities());
     $this->assertInstanceOf(Fixtures\RelatedIndexEntity::class, $entityWithIndexedRelation->getRelatedIndexEntities()->get('test'));
 }