Neos\Flow\Reflection\ClassSchema::setRepositoryClassName PHP Метод

setRepositoryClassName() публичный Метод

Set the class name of the repository managing an entity.
public setRepositoryClassName ( string $repositoryClassName ) : void
$repositoryClassName string
Результат void
    public function setRepositoryClassName($repositoryClassName)
    {
        if ($this->modelType === self::MODELTYPE_VALUEOBJECT && $repositoryClassName !== null) {
            throw new Exception\ClassSchemaConstraintViolationException('Value objects must not be aggregate roots (have a repository)', 1268739172);
        }
        $this->repositoryClassName = $repositoryClassName;
    }

Usage Example

 /**
  * @test
  */
 public function setModelTypeResetsIdentityPropertiesAndAggregateRootForValueObjects()
 {
     $classSchema = new ClassSchema('SomeClass');
     $classSchema->setModelType(ClassSchema::MODELTYPE_ENTITY);
     $classSchema->addProperty('foo', 'string');
     $classSchema->addProperty('bar', 'string');
     $classSchema->markAsIdentityProperty('bar');
     $classSchema->setRepositoryClassName('Some\\Repository');
     $this->assertSame(['bar' => 'string'], $classSchema->getIdentityProperties());
     $classSchema->setModelType(ClassSchema::MODELTYPE_VALUEOBJECT);
     $this->assertSame([], $classSchema->getIdentityProperties());
     $this->assertFalse($classSchema->isAggregateRoot());
 }