Question about Zf2 form elements - DateTime. hidden

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Question about Zf2 form elements - DateTime. hidden

b4barry
This post has NOT been accepted by the mailing list yet.
I have an application in whivh every record has 4 columns

create_by,created_at,Updated_by,updated_at

the _by columns are not null and refer to the logged in user responsible for the actions
the _at columns are the DateTime stamp of the operation.

I would normally add these add hidden fields in a Form.


        /**
         *
         * @ORM\Column(type= "integer")
         *
         * @todo add reference to AUTH
         *      
         */
        protected $created_by;
       
        /**
         *
         *
         * @ORM\Column(type= "datetime")
         *
         * @todo add reference to AUTH
         *      
         */
        protected $created_at;
       
        /**
         *
         *
         * @ORM\Column(type= "integer")
         *
         * @todo add reference to AUTH
         *      
         */
        protected $updated_by;
       
        /**
         *
         *
         * @ORM\Column(type= "datetime")
         *
         * @todo add reference to AUTH
         *      
         */
        protected $updated_at;

In my form I tried:

 $this->add(array(
                        'name' => 'created_at',
                        'type'  => 'Hidden',
                        )
                  );

I get the following error:

"Object provided to Escape helper, but flags do not allow recursion"

What is accepted way of doing this?  
would I be better off not including the values in the form and simply adding a pre-persist function to cater for update() ?