X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/4e2dd7b0482d5ac0d7c031afb5b24061da8d1373..cb55dba78691e9563c2d72ff70ce3e40833fef7a:/Form/Extension/Type/HiddenEntityType.php?ds=sidebyside diff --git a/Form/Extension/Type/HiddenEntityType.php b/Form/Extension/Type/HiddenEntityType.php index 7521633..f9b27d1 100644 --- a/Form/Extension/Type/HiddenEntityType.php +++ b/Form/Extension/Type/HiddenEntityType.php @@ -40,7 +40,7 @@ class HiddenEntityType extends HiddenType implements DataTransformerInterface { * * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) { + public function configureOptions(OptionsResolver $resolver): void { //Call parent parent::configureOptions($resolver); @@ -102,24 +102,24 @@ class HiddenEntityType extends HiddenType implements DataTransformerInterface { /** * Reverse transformation from string to data object * - * @param string $data The object id + * @param mixed $value The object id * @return mixed The data object */ - public function reverseTransform($data) { - if (!$data) { + public function reverseTransform(mixed $value): mixed { + if (!$value) { return null; } $res = null; try { $rep = $this->dm->getRepository($this->class); - $res = $rep->findOneById($data); + $res = $rep->findOneById($value); } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage()); } if ($res === null) { - throw new TransformationFailedException(sprintf('A %s with id %s does not exist!', $this->class, $data)); + throw new TransformationFailedException(sprintf('A %s with id %s does not exist!', $this->class, $value)); } return $res;