php - Symfony : Error creating form (BirthdayType) and methods note functionning proprely -


i've been trying create form people can create account in database.

the form ask 3 things : first name, last name , date of birth (text in french in code).

i keep on having these errors :

neither property "startdatetime" nor 1 of methods "addstartdatetime()"/"removestartdatetime()", "setstartdatetime()", "startdatetime()", "__set()" or "__call()" exist , have public access in class "appbundle\entity\candidats".

is because didn't declare type correctly in entity when created ?

here's entity class :

    <?php  namespace appbundle\entity;  use doctrine\orm\mapping orm;  /**  * candidats  *  * @orm\table(name="candidats")  * @orm\entity  */ class candidats {     /**      * @var string      *      * @orm\column(name="nom", type="string", length=30, nullable=false)      */     private $nom;      /**      * @var string      *      * @orm\column(name="prenom", type="string", length=30, nullable=false)      */     private $prenom;      /**      * @var \datetime      *      * @orm\column(name="datedenaissance", type="date", nullable=true)      */     private $datedenaissance;      /**      * @var integer      *      * @orm\column(name="idcand", type="integer")      * @orm\id      * @orm\generatedvalue(strategy="identity")      */     private $idcand;        /**      * set nom      *      * @param string $nom      *      * @return candidats      */     public function setnom($nom)     {         $this->nom = $nom;          return $this;     }      /**      * nom      *      * @return string      */     public function getnom()     {         return $this->nom;     }      /**      * set prenom      *      * @param string $prenom      *      * @return candidats      */     public function setprenom($prenom)     {         $this->prenom = $prenom;          return $this;     }      /**      * prenom      *      * @return string      */     public function getprenom()     {         return $this->prenom;     }      /**      * set datedenaissance      *      * @param \datetime $datedenaissance      *      * @return candidats      */     public function setdatedenaissance($datedenaissance)     {         $this->datedenaissance = $datedenaissance;          return $this;     }      /**      * datedenaissance      *      * @return \datetime      */     public function getdatedenaissance()     {         return $this->datedenaissance;     } public function getdatetime()     {         return $this->datedenaissance;     }     public function getstartdatetime()     {         return $this->datedenaissance;     }     public function startdatetime()     {         return $this->datedenaissance;     }     public function isstartdatetime()     {         return $this->datedenaissance;     }  public function hasstartdatetime()     {         return $this->datedenaissance;     }     public function addstartdatetime()     {         return $this->datedenaissance;     }     public function removestartdatetime()     {         return $this->datedenaissance;     } public function setstartdatetime()     {         return $this->datedenaissance;     }         /**      * idcand      *      * @return integer      */     public function getidcand()     {         return $this->idcand;     } } 

and snipet of code in form creation modified :

<?php  namespace appbundle\form;  use symfony\component\form\abstracttype; use symfony\component\form\formbuilderinterface; use symfony\component\optionsresolver\optionsresolver; use symfony\component\form\extension\core\type\birthdaytype;  class candidatstype extends abstracttype {     /**      * @param formbuilderinterface $builder      * @param array $options      */     public function buildform(formbuilderinterface $builder, array $options)     {         $builder             ->add('nom')             ->add('prenom')             ->add('startdatetime', birthdaytype::class)         ;     }      /**      * @param optionsresolver $resolver      */     public function configureoptions(optionsresolver $resolver)     {         $resolver->setdefaults(array(             'data_class' => 'appbundle\entity\candidats'         ));     } } 

i think problem properties names. in class, there nom, prenom , datedenaissance. , in form there nom, prenom , startdatetime. that's why form doesn't find property startdatetime, because doesn't exist in class.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -