I'm using Zend, Doctrine2.1 and AnnotationForms.
My entity looks like this:
/**
* @ORM\Entity
* @ORM\Table(name="myentity")
* @Form\Name("myentity")
* @Form\Attributes({ "class": "form-horizontal" })
* @Form\Hydrator("\DoctrineModule\Stdlib\Hydrator\DoctrineObject")
*/
class MyEntity {
...
}
When using this DoctrineObject
I get the following error:
Catchable fatal error: Argument 1 passed to DoctrineModule\Stdlib\Hydrator\DoctrineObject::__construct() must be an instance of Doctrine\Common\Persistence\ObjectManager, none given, called in C:\vendor\zendframework\zendframework\library\Zend\Form\Factory.php on line 566 and defined in C:\vendor\doctrine\doctrine-module\src\DoctrineModule\Stdlib\Hydrator\DoctrineObject.php on line 63
I cannot use Zend\Stdlib\Hydrator\ObjectProperty
because then I get
Fatal error: Cannot access protected property
I'm quite lost. Anybody an idea what I can do to fix this issue?
I'm guessing that I need a __construct()
function. But what do I put in there?
FormElementManager
service? 2) Have you tried registering theDoctrineModule\Stdlib\Hydrator\DoctrineObject
as a factory? – emix