thanks :) On 20 February 2011 13:33, Reuven <reuven.aboul...@gmail.com> wrote: > I reimplemented one and it works. > Here the code. > > namespace Symfony\Component\Form\ValueTransformer; > use Symfony\Component\Form\Configurable; > class EntityToIDTransformer extends Configurable implements > ValueTransformerInterface > { > protected function configure() > { > $this->addRequiredOption('em'); > $this->addRequiredOption('class'); > > parent::configure(); > } > > public function reverseTransform($newId) > { > if (empty($newId)) { > return null; > } > > return $this->getOption('em')->find($this->getOption('class'), > $newId); > } > > public function transform($entity) > { > if (empty($entity)) { > return 0; > } > > return current( $this->getOption('em')->getUnitOfWork()- >>getEntityIdentifier($entity) ); > } > } > > I hope it will help you. > > Regards, > Reuven > > On 20 fév, 12:33, Dan Leech <dan.t.le...@gmail.com> wrote: >> hello >> >> I am trying to reimplement the old Doctrine transformers after >> upgrading from PR5, but there seems to be a contradiction with the >> interface, reverseTransform is called with 2 arguments. >> >> // Symfony\Component\Form\Field >> protected function reverseTransform($value) >> { >> return '' === $value ? null : $value; >> } >> return $this->valueTransformer->reverseTransform($value, >> $this->data); >> } >> >> but the interface only allows one: >> >> // Symfony\Component\Form\ValueTransformer\ValueTransformerInterface >> function reverseTransform($value); >> >> If the interface is correct, how can the transformers access the form >> data object? >> >> thanks >> >> dan >> >> On 18 February 2011 13:24, Bernhard Schussek <bschus...@gmail.com> wrote: >> >> >> >> > It was removed because its implementation was buggy/bad. You can copy >> > the old implementation into your project and use it this way. A new >> > version of it will come soon. >> >> > Bernhard >> >> > -- >> > If you want to report a vulnerability issue on symfony, please send it to >> > security at symfony-project.com >> >> > You received this message because you are subscribed to the Google >> > Groups "symfony users" group. >> > To post to this group, send email to symfony-users@googlegroups.com >> > To unsubscribe from this group, send email to >> > symfony-users+unsubscr...@googlegroups.com >> > For more options, visit this group at >> >http://groups.google.com/group/symfony-users?hl=en >> >> -- >> Dan Leech >> >> Web Developerwww.dantleech.com > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en >
-- Dan Leech Web Developer www.dantleech.com -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en