示例#1
0
 /**
  * Validates and completes the mapping.
  *
  * @param array $mapping The mapping to validate and complete.
  * @return array The validated and completed mapping.
  * @override
  */
 protected function _validateAndCompleteMapping(array $mapping)
 {
     parent::_validateAndCompleteMapping($mapping);
     // one-side MUST be inverse (must have mappedBy)
     if (!isset($mapping['mappedBy'])) {
         throw MappingException::oneToManyRequiresMappedBy($mapping['fieldName']);
     }
     $this->deleteOrphans = isset($mapping['deleteOrphans']) ? (bool) $mapping['deleteOrphans'] : false;
 }
 /**
  * Validates and completes the mapping.
  *
  * @param array $mapping The mapping to validate and complete.
  * @return array The validated and completed mapping.
  * @override
  */
 protected function _validateAndCompleteMapping(array $mapping)
 {
     parent::_validateAndCompleteMapping($mapping);
     // OneToMany-side MUST be inverse (must have mappedBy)
     if (!isset($mapping['mappedBy'])) {
         throw MappingException::oneToManyRequiresMappedBy($mapping['fieldName']);
     }
     //TODO: if orphanRemoval, cascade=remove is implicit!
     $this->orphanRemoval = isset($mapping['orphanRemoval']) ? (bool) $mapping['orphanRemoval'] : false;
     if (isset($mapping['orderBy'])) {
         if (!is_array($mapping['orderBy'])) {
             throw new \InvalidArgumentException("'orderBy' is expected to be an array, not " . gettype($mapping['orderBy']));
         }
         $this->orderBy = $mapping['orderBy'];
     }
 }