* @author Gediminas Morkevicius * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ class Yaml extends File implements Driver { /** * File extension * @var string */ protected $_extension = '.dcm.yml'; /** * {@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']; } } } } /** * {@inheritDoc} */ protected function _loadMappingFile($file) { return \Symfony\Component\Yaml\Yaml::parse($file); } }