/**
  * {@inheritDoc}
  */
 public function readExtendedMetadata($meta, array &$config)
 {
     $class = $meta->getReflectionClass();
     // class annotations
     if ($class !== null && ($annot = $this->reader->getClassAnnotation($class, self::SOFT_DELETEABLE))) {
         $config['softDeleteable'] = true;
         Validator::validateField($meta, $annot->fieldName);
         $config['fieldName'] = $annot->fieldName;
     }
     $this->validateFullMetadata($meta, $config);
 }
示例#2
0
 /**
  * {@inheritDoc}
  */
 public function readExtendedMetadata($meta, array &$config)
 {
     $mapping = $this->_getMapping($meta->name);
     if (isset($mapping['gedmo'])) {
         $classMapping = $mapping['gedmo'];
         if (isset($classMapping['soft_deleteable'])) {
             $config['softDeleteable'] = true;
             if (!isset($classMapping['soft_deleteable']['field_name'])) {
                 throw new InvalidMappingException('Field name for SoftDeleteable class is mandatory.');
             }
             $fieldName = $classMapping['soft_deleteable']['field_name'];
             Validator::validateField($meta, $fieldName);
             $config['fieldName'] = $fieldName;
         }
     }
 }
 /**
  * {@inheritDoc}
  */
 public function readExtendedMetadata($meta, array &$config)
 {
     $class = $this->getMetaReflectionClass($meta);
     // class annotations
     if ($class !== null && ($annot = $this->reader->getClassAnnotation($class, self::SOFT_DELETEABLE))) {
         $config['softDeleteable'] = true;
         Validator::validateField($meta, $annot->fieldName);
         $config['fieldName'] = $annot->fieldName;
         $config['timeAware'] = false;
         if (isset($annot->timeAware)) {
             if (!is_bool($annot->timeAware)) {
                 throw new InvalidMappingException("timeAware must be boolean. " . gettype($annot->timeAware) . " provided.");
             }
             $config['timeAware'] = $annot->timeAware;
         }
     }
     $this->validateFullMetadata($meta, $config);
 }
示例#4
0
 /**
  * {@inheritDoc}
  */
 public function readExtendedMetadata($meta, array &$config)
 {
     /**
      * @var \SimpleXmlElement $xml
      */
     $xml = $this->_getMapping($meta->name);
     $xmlDoctrine = $xml;
     $xml = $xml->children(self::GEDMO_NAMESPACE_URI);
     if ($xmlDoctrine->getName() == 'entity' || $xmlDoctrine->getName() == 'mapped-superclass') {
         if (isset($xml->{'soft-deleteable'})) {
             $field = $this->_getAttribute($xml->{'soft-deleteable'}, 'field-name');
             if (!$field) {
                 throw new InvalidMappingException('Field name for SoftDeleteable class is mandatory.');
             }
             Validator::validateField($meta, $field);
             $config['softDeleteable'] = true;
             $config['fieldName'] = $field;
         }
     }
 }
示例#5
0
 /**
  * {@inheritDoc}
  */
 public function readExtendedMetadata($meta, array &$config)
 {
     $mapping = $this->_getMapping($meta->name);
     if (isset($mapping['gedmo'])) {
         $classMapping = $mapping['gedmo'];
         if (isset($classMapping['soft_deleteable'])) {
             $config['softDeleteable'] = true;
             if (!isset($classMapping['soft_deleteable']['field_name'])) {
                 throw new InvalidMappingException('Field name for SoftDeleteable class is mandatory.');
             }
             $fieldName = $classMapping['soft_deleteable']['field_name'];
             Validator::validateField($meta, $fieldName);
             $config['fieldName'] = $fieldName;
             $config['timeAware'] = false;
             if (isset($classMapping['soft_deleteable']['time_aware'])) {
                 if (!is_bool($classMapping['soft_deleteable']['time_aware'])) {
                     throw new InvalidMappingException("timeAware must be boolean. " . gettype($classMapping['soft_deleteable']['time_aware']) . " provided.");
                 }
                 $config['timeAware'] = $classMapping['soft_deleteable']['time_aware'];
             }
         }
     }
 }
示例#6
0
 /**
  * {@inheritDoc}
  */
 public function readExtendedMetadata($meta, array &$config)
 {
     /**
      * @var \SimpleXmlElement $xml
      */
     $xml = $this->_getMapping($meta->name);
     $xmlDoctrine = $xml;
     $xml = $xml->children(self::GEDMO_NAMESPACE_URI);
     if (in_array($xmlDoctrine->getName(), array('mapped-superclass', 'entity', 'document', 'embedded-document'))) {
         if ($xml->count() > 0 && isset($xml->{'soft-deleteable'})) {
             $field = $this->_getAttribute($xml->{'soft-deleteable'}, 'field-name');
             if (!$field) {
                 throw new InvalidMappingException('Field name for SoftDeleteable class is mandatory.');
             }
             Validator::validateField($meta, $field);
             $config['softDeleteable'] = true;
             $config['fieldName'] = $field;
             $config['timeAware'] = false;
             if ($this->_isAttributeSet($xml->{'soft-deleteable'}, 'time-aware')) {
                 $config['timeAware'] = $this->_getBooleanAttribute($xml->{'soft-deleteable'}, 'time-aware');
             }
         }
     }
 }