php - Symfony2 Forms Error: Warning: spl_object_hash() expects parameter 1 to be object, array given -


and day comes when need ask help:

i have problem forms in symfony2.8.

\form\bookordertype.php

class bookordertype extends abstracttype {     /**      * {@inheritdoc}      */     public function buildform(formbuilderinterface $builder, array $options)     {         $builder             ->add('customer', customertype::class)             ->add('event', entitytype::class, array(                 'class' => 'appbundle:event',                 'choice_label' => 'name'             ))             ->add('ticket', tickettype::class)             ->add('add', submittype::class)             ->getform()         ;     }      /**      * {@inheritdoc}      */     public function configureoptions(optionsresolver $resolver)     {         $resolver->setdefaults(array(             'data_class' => 'appbundle\entity\bookorder'         ));     }      /**      * {@inheritdoc}      */     public function getblockprefix()     {         return 'appbundle_bookorder';     }   } 

\form\tickettype.php

class tickettype extends abstracttype {     /**      * {@inheritdoc}      */     public function buildform(formbuilderinterface $builder, array $options)     {         $builder             ->add('adult', integertype::class)             ->add('child', integertype::class)             ->add('senior', integertype::class);     }      /**      * {@inheritdoc}      */     public function configureoptions(optionsresolver $resolver)     {         $resolver->setdefaults(array(             'data_class' => 'appbundle\entity\ticket'         ));     }      /**      * {@inheritdoc}      */     public function getblockprefix()     {         return 'appbundle_ticket';     }   } 

\entity\ticket.php

<?php  namespace appbundle\entity;  use doctrine\orm\mapping orm;  /**  * ticket  *  * @orm\table(name="ticket")  * @orm\entity(repositoryclass="appbundle\repository\ticketrepository")  */ class ticket {     /**      * @orm\onetoone(targetentity="bookorder", cascade="persist", mappedby="ticket")      */     private $bookorder;      /**      * @var int      *      * @orm\column(name="id", type="integer")      * @orm\id      * @orm\generatedvalue(strategy="auto")      */     private $id;      /**      * @var int      *      * @orm\column(name="adult", type="integer")      */     private $adult;      /**      * @var int      *      * @orm\column(name="child", type="integer")      */     private $child;      /**      * @var int      *      * @orm\column(name="senior", type="integer")      */     private $senior;       /**      * id      *      * @return integer       */     public function getid()     {         return $this->id;     }      /**      * set adult      *      * @param integer $adult      * @return ticket      */     public function setadult($adult)     {         $this->adult = $adult;          return $this;     }      /**      * adult      *      * @return integer       */     public function getadult()     {         return $this->adult;     }      /**      * set child      *      * @param integer $child      * @return ticket      */     public function setchild($child)     {         $this->child = $child;          return $this;     }      /**      * child      *      * @return integer       */     public function getchild()     {         return $this->child;     }      /**      * set senior      *      * @param integer $senior      * @return ticket      */     public function setsenior($senior)     {         $this->senior = $senior;          return $this;     }      /**      * senior      *      * @return integer       */     public function getsenior()     {         return $this->senior;     }      /**      * set bookorder      *      * @param \appbundle\entity\bookorder $bookorder      * @return ticket      */     public function setbookorder(\appbundle\entity\bookorder $bookorder = null)     {         $this->bookorder = $bookorder;          return $this;     }      /**      * bookorder      *      * @return \appbundle\entity\bookorder       */     public function getbookorder()     {         return $this->bookorder;     } } 

the problem , question tickettype: why give me array instead of object. rest of forms inside bookordertype (customertype , event) give me object (with right content) tickettype giving me array 1 object (which contains expect). how can fix object outside, instead of array?

i looking such problem few hours in here , on internet no results.... can help?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -