Zend框架2 - Hydrator策略不响应和保湿 [英] Zend Framework 2 - Hydrator strategy not responding and hydrating
问题描述
我基本上实现了此策略。
主要区别是(我猜)我使用 Doctrine2
。
构造函数类是调用(打印测试回显),但两个函数 extract()
和 hydrate()
不是。 p>
我添加了如下策略:
$ hydrator = new DoctrineEntity $的EntityManager);
$ hydrator-> getHydrator() - > addStrategy('my_attribute',new MyHydrationStrategy());
$ form-> setHydrator($ hydrator);
类似的问题是发布在这里。
也许问题是我如何添加这个策略。但是我真的不知道...
如果有人能给我一个提示我做错了什么会很棒。
请参考这篇文章,找一个更干净,更合适的解决方案!
Zend Framework 2 - Hydrator策略为Doctrine关系不工作
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.
Please refer to this post, for a cleaner and more appropriate solution!
Zend Framework 2 - Hydrator strategy for Doctrine relationship not working
这篇关于Zend框架2 - Hydrator策略不响应和保湿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!