Inheritance: extends SuperEntity
 /**
  * @test
  */
 public function findByIdentifierReturnsSubTypesOfTheManagedType()
 {
     $this->superEntityRepository = $this->objectManager->get(Fixtures\SuperEntityRepository::class);
     $subEntity = new Fixtures\SubEntity();
     $subEntity->setContent('this is the sub entity');
     $this->superEntityRepository->add($subEntity);
     $identifier = $this->persistenceManager->getIdentifierByObject($subEntity);
     $this->persistenceManager->persistAll();
     $subEntity = $this->superEntityRepository->findByIdentifier($identifier);
     $this->assertEquals('this is the sub entity', $subEntity->getContent());
 }
 /**
  * @test
  */
 public function distinctQueryOnlyReturnsDistinctEntities()
 {
     $testEntityRepository = new Fixtures\TestEntityRepository();
     $testEntityRepository->removeAll();
     $testEntity = new Fixtures\TestEntity();
     $testEntity->setName('Flow');
     $subEntity1 = new Fixtures\SubEntity();
     $subEntity1->setContent('value');
     $subEntity1->setParentEntity($testEntity);
     $testEntity->addSubEntity($subEntity1);
     $this->persistenceManager->add($subEntity1);
     $subEntity2 = new Fixtures\SubEntity();
     $subEntity2->setContent('value');
     $subEntity2->setParentEntity($testEntity);
     $testEntity->addSubEntity($subEntity2);
     $this->persistenceManager->add($subEntity2);
     $testEntityRepository->add($testEntity);
     $testEntity2 = new Fixtures\TestEntity();
     $testEntity2->setName('Flow');
     $subEntity3 = new Fixtures\SubEntity();
     $subEntity3->setContent('value');
     $subEntity3->setParentEntity($testEntity2);
     $testEntity2->addSubEntity($subEntity3);
     $this->persistenceManager->add($subEntity3);
     $testEntityRepository->add($testEntity2);
     $this->persistenceManager->persistAll();
     $query = new Query(Fixtures\TestEntity::class);
     $entities = $query->matching($query->equals('subEntities.content', 'value'))->setDistinct()->setLimit(2)->execute()->toArray();
     $this->assertEquals(2, count($entities));
 }
 /**
  * @test
  */
 public function validationIsEnforcedForParentObject()
 {
     $entity = new TestEntity();
     $entity->setName('Some Name');
     $this->testEntityRepository->add($entity);
     $subEntity = new SubEntity();
     $subEntity->setContent('Sub Entity');
     $subEntity->setParentEntity($entity);
     $entity->addSubEntity($subEntity);
     $this->persistenceManager->add($subEntity);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $entityIdentifier = $this->persistenceManager->getIdentifierByObject($entity);
     $subEntityIdentifier = $this->persistenceManager->getIdentifierByObject($subEntity);
     $invalidArguments = ['entity' => ['__identity' => $entityIdentifier, 'name' => 'xx', 'subEntities' => [['__identity' => $subEntityIdentifier, 'content' => 'some valid content']]]];
     $response = $this->browser->request('http://localhost/test/validation/entity/update', 'POST', $invalidArguments);
     $this->assertSame('An error occurred while trying to call Neos\\Flow\\Tests\\Functional\\Mvc\\Fixtures\\Controller\\EntityController->updateAction().' . PHP_EOL . 'Error for entity.name:  This field must contain at least 3 characters.' . PHP_EOL, $response->getContent());
 }