I implemented basically this strategy.
The main difference is (I guess) that I use Doctrine2
.
The constructor class is called (a test echo is printed) but the two functions extract()
and hydrate()
are not.
I added the strategy as follows:
$hydrator = new DoctrineEntity($entityManager);
$hydrator->getHydrator()->addStrategy('my_attribute', new MyHydrationStrategy());
$form->setHydrator($hydrator);
A kind-of similar issue was posted here.
Maybe the problem is in the way how I add this strategy. But I honestly don't know...
Would be great if somebody could give me a hint what I'm doing wrong.
@Sam solved this problem on GitHub.
My code now looks like this:
BTW: The underscore in the attribute doesn't cause any problems
Unfortunately I stumbled upon another foreign-key-relation-based issue, it seems even a
Doctrine
issue. But I'll open a new question for this.Please refer to this post, for a cleaner and more appropriate solution!
Zend Framework 2 - Hydrator strategy for Doctrine relationship not working