/** * {@inheritdoc} */ public function apply(CompiledTransformMappingInterface $transformMapping, $locale, array $input, $instance = null) { if ($instance === null) { $modelClass = $transformMapping->getModelClass(); $instance = new $modelClass(); } if (method_exists($instance, 'setLocale') === true) { $instance->setLocale($locale); } // FIXME: we should filter out fields when data is supplied for a field that cannot be set? foreach ($input as $key => $value) { if (($field = $transformMapping->findField($key, SetterField::OPERATION)) !== null) { $this->applyField($transformMapping, $instance, $field, $value); } } return $instance; }