parseAnnotationValues() public static method

Parse value pieces of requested annotation from given doc comment
public static parseAnnotationValues ( string $annotation, string $docComment ) : array
$annotation string
$docComment string
return array
Esempio n. 1
0
 /**
  * @throws InvalidStateException
  */
 private function parseProperties()
 {
     $this->properties = [];
     $annotationTypes = ['property', 'property-read'];
     $columns = [];
     foreach ($this->getFamilyLine() as $member) {
         foreach ($annotationTypes as $annotationType) {
             foreach (AnnotationsParser::parseAnnotationValues($annotationType, $member->getDocComment()) as $definition) {
                 $property = PropertyFactory::createFromAnnotation($annotationType, $definition, $member, $this->mapper);
                 // collision check
                 $column = $property->getColumn();
                 if ($column !== null and $property->isWritable()) {
                     if (isset($columns[$column])) {
                         throw new InvalidStateException("Mapping collision in property '{$property->getName()}' (column '{$column}') in entity {$this->getName()}. Please fix mapping or make chosen properties read only (using property-read).");
                     }
                     $columns[$column] = true;
                 }
                 $this->properties[$property->getName()] = $property;
             }
         }
     }
 }