コード例 #1
0
 /**
  * @return Identity
  */
 public final function getId() : Identity
 {
     if (empty($this->aggregateIdentifier)) {
         $this->readAnnotatedAggregateIdentifier();
     }
     return $this->{$this->aggregateIdentifier->getPropertyName()};
 }
コード例 #2
0
 /**
  * @param \Apha\Annotations\Annotation\AggregateIdentifier $annotation,
  * @param \ReflectionProperty $reflectionProperty
  * @return \Apha\Annotations\Annotation\AggregateIdentifier
  * @throws AnnotationReaderException
  */
 private function processAnnotation(\Apha\Annotations\Annotation\AggregateIdentifier $annotation, \ReflectionProperty $reflectionProperty) : \Apha\Annotations\Annotation\AggregateIdentifier
 {
     if (!in_array($annotation->getType(), $this->validScalarTypes) && !class_exists($annotation->getType(), true)) {
         throw new AnnotationReaderException("Type '{$annotation->getType()}' is not a valid AggregateIdentifier type.");
     }
     if ($reflectionProperty->isPrivate()) {
         throw new AnnotationReaderException("Property must not be private.");
     }
     $annotation->setPropertyName($reflectionProperty->getName());
     return $annotation;
 }