Beispiel #1
0
 /**
  * @param ClassMetadataInfo $cm
  * @param string            $columnName
  * @return bool
  */
 protected function isColumnRevised(ClassMetadataInfo $cm, $columnName)
 {
     try {
         $propertyName = $cm->getFieldForColumn($columnName);
         return $this->annotationReader->isPropertyRevised($cm->name, $propertyName);
     } catch (MappingException $e) {
         if ($cm->isInheritanceTypeSingleTable()) {
             foreach ($cm->subClasses as $subClass) {
                 $subClassMeta = $this->getClassMetaData($subClass);
                 try {
                     $propertyName = $subClassMeta->getFieldForColumn($columnName);
                     return $this->annotationReader->isPropertyRevised($subClassMeta->name, $propertyName);
                 } catch (MappingException $e) {
                 }
             }
         }
     }
     return false;
 }
Beispiel #2
0
 /**
  * Gets all annotations
  *
  * @param  [type] $entity [description]
  * @return [type] [description]
  */
 public function all($entity)
 {
     $reflectionClass = new \ReflectionClass($entity);
     $properties = $reflectionClass->getProperties();
     $class = new \ReflectionClass($entity);
     while ($parent = $class->getParentClass()) {
         $parentProperties = $parent->getProperties();
         $properties = array_merge($parentProperties, $properties);
         $class = $parent;
     }
     $return = array();
     foreach ($properties as $reflectionProperty) {
         $propertyAnnotation = $this->reader->getPropertyAnnotation($reflectionProperty, $this->annotationClass);
         if (!is_null($propertyAnnotation) && $propertyAnnotation->listable) {
             $return[] = array('property' => $reflectionProperty->name, 'type' => $propertyAnnotation->type);
         }
     }
     return $return;
 }
Beispiel #3
0
 /**
  * @param object $entity
  */
 protected function setRevisionInfo($entity)
 {
     if ($this->annotationReader->isDraft($entity) && $entity->isDraft()) {
         $this->draft = true;
     }
 }