You are here

public function AnnotationReader::getPropertyAnnotation in Plug 7

Gets a property annotation.

Parameters

\ReflectionProperty $property The ReflectionProperty to read the annotations from.:

string $annotationName The name of the annotation.:

Return value

object|null The Annotation or NULL, if the requested annotation does not exist.

Overrides Reader::getPropertyAnnotation

File

lib/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php, line 232

Class

AnnotationReader
A reader for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) {
  $annotations = $this
    ->getPropertyAnnotations($property);
  foreach ($annotations as $annotation) {
    if ($annotation instanceof $annotationName) {
      return $annotation;
    }
  }
  return null;
}