php - ORA-01861: literal does not match format string while using DateTime -


i try persist entity database , face the ora-01861: literal not match format string error. know of times error between dates , strings'conversions leads message. might case me too, can't figure out why. here sql statement (from profiler) :

insert person (no_person, first_name, usual_name, last_name, birth_date, comments, c_user_creation, date_creation, c_user_modification,  date_modification, email, id_rh, cod_civ) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,  ?, ? ) parameters: { 1: '173704', 2: test, 3: 'null', 4: test, 5: object(datetime), 6: 'null',  7: web, 8: object(datetime), 9: 'null', 10: 'null', 11: zefzf@dgeghte.fr, 12: 'null', 13: '1'} time: 0.00 ms  

the person entity :

<?php  namespace my\mybundle\entity;   use doctrine\orm\mapping orm; use symfony\component\httpfoundation\file\uploadedfile;  /**  * my\mybundle\entity\person  *  * @orm\table(name="person")  * @orm\entity(repositoryclass="my\mybundle\entity\personrepository")  */ class person { /**  *  * @orm\id  * @orm\generatedvalue(strategy="sequence")  * @orm\column(name="no_person", type="integer")  * @orm\sequencegenerator(sequencename="seq_no_person")  */ public $noperson;  /**  *  * @orm\manytoone(targetentity="civility")  * @orm\joincolumn(name="cod_civ", referencedcolumnname="cod_civ")  */ private $civility;  /**  * @var string $firstname  *  * @orm\column(name="first_name", type="string", length=30)  */ private $firstname;  /**  * @var string $usualname  *  * @orm\column(name="usual_name", type="string", length=30)  */ private $usualname;  /**  * @var string $lastname  *  * @orm\column(name="last_name", type="string", length=20)  */ private $lastname;  /**  * @var date $birthdate  *  * @orm\column(name="birth_date", type="date")  */ private $birthdate;  /**  * @var string $comment  *  * @orm\column(name="comment", type="string", length=300)  */ private $comment;  /**  * @var string $cusercreation  *  * @orm\column(name="c_user_creation", type="string", length=30)  */ private $cusercreation;  /**  * @var date $dcreation  *  * @orm\column(name="date_creation", type="date")  */     private $dcreation;  /**  * @var string $cusermodification  *  * @orm\column(name="c_user_modification", type="string", length=30)  */ private $cusermodification;  /**  * @var date $dmodification  *  * @orm\column(name="date_modification", type="date")  */     private $dmodification;  /**  * @var string $email  *  * @orm\column(name="email", type="string", length=100)  */ private $email;  /**  * @var integer $idrh  *  * @orm\column(name="id_rh", type="integer")  */ private $idrh;  /**  * @var \doctrine\common\collections\arraycollection $acccip  *  * @orm\onetomany(targetentity="my\mybundle\entity\acccip",mappedby="person")  */  private $acccip;   /**  * @var \doctrine\common\collections\arraycollection $cartes  *  * @orm\onetomany(targetentity="my\mybundle\entity\carte",mappedby="person")  */  private $cartes;  /**  * @var \doctrine\common\collections\arraycollection $panier  *  * @orm\onetomany(targetentity="my\mybundle\entity\panier",mappedby="person")  */  private $panier;  /**  * @var \doctrine\common\collections\arraycollection $transactions  *  * @orm\onetomany(targetentity="my\mybundle\entity\transactionpaybox",mappedby="person")  */  private $transactions;  /**  * @var my\mybundle\entity\adresse $adresses  *  * @orm\onetomany(targetentity="my\mybundle\entity\adresse",mappedby="person",cascade={"persist"})  */ private $adresses;  public function __construct() {     $this->cusercreation = "web";     $this->dcreation = new \datetime();     $this->birthdate = new \datetime();     $this->cartes = new \doctrine\common\collections\arraycollection();     $this->acccip = new \doctrine\common\collections\arraycollection();     $this->panier = new \doctrine\common\collections\arraycollection();     $this->transactions = new \doctrine\common\collections\arraycollection();     $this->insactspos = new \doctrine\common\collections\arraycollection();     $this->adresses = new \doctrine\common\collections\arraycollection(); }  /**  * noperson  *  * @return integer   */ public function getnoperson() {     return $this->noperson; }  /**  * set firstname  *  * @param string $firstname  */ public function setfirstname($firstname) {     $this->firstname = $firstname; }  /**  * firstname  *  * @return string   */ public function getfirstname() {     return $this->firstname; }  /**  * set usualname  *  * @param string $usualname  */ public function setusualname($usualname) {     $this->usualname = $usualname; }  /**  * usualname  *  * @return string   */ public function getusualname() {     return $this->usualname; }  /**  * set lastname  *  * @param string $lastname  */ public function setlastname($lastname) {     $this->lastname = $lastname; }  /**  * lastname  *  * @return string   */ public function getlastname() {     return $this->lastname; }  /**  * set birthdate  *  * @param string $birthdate  */ public function setbirthdate(\datetime $birthdate) {     $this->birthdate = clone $birthdate; }  /**  * birthdate  *  * @return string   */ public function getbirthdate() {     return $this->birthdate; }  /**  * set comment  *  * @param string $comment  */ public function setcomment($comment) {     $this->comment = $comment; }  /**  * comment  *  * @return string   */ public function getcomment() {     return $this->comment; }  /**  * set cusercreation  *  * @param string $cusercreation  */ public function setcusercreation($cusercreation) {     $this->cusercreation = $cusercreation; }  /**  * cusercreation  *  * @return string   */ public function getcusercreation() {     return $this->cusercreation; }  /**  * set dcreation  *  * @param string $dcreation  */ public function setdcreation(\datetime $dcreation) {     $this->dcreation = clone $dcreation; }  /**  * dcreation  *  * @return string   */ public function getdcreation() {     return $this->dcreation; }  /**  * set cusermodification  *  * @param string $cusermodification  */ public function setcusermodification($cusermodification) {     $this->cusermodification = $cusermodification; }  /**  * cusermodification  *  * @return string   */ public function getcusermodification() {     return $this->cusermodification; }  /**  * set dmodification  *  * @param string $dmodification  */ public function setdmodification(\datetime $dmodification) {     $this->dmodification = clone $dmodification; }  /**  * dmodification  *  * @return string   */ public function getdmodification() {     return $this->dmodification; }  /**  * set email  *  * @param string $email  */ public function setemail($email) {     $this->email = $email; }  /**  * email  *  * @return string   */ public function getemail() {     return $this->email; }  /**  * set idrh  *  * @param integer $idrh  */ public function setidrh($idrh) {     $this->idrh = $idrh; }  /**  * idrh  *  * @return integer   */ public function getidrh() {     return $this->idrh; }  /**  * set civility  *  * @param my\mybundle\entity\civility $civility  */ public function setcivility(\my\mybundle\entity\civility $civility) {     $this->civility = $civility; }  /**  * civility  *  * @return my\mybundle\entity\civility   */ public function getcivility() {     return $this->civility; }  /**  * acccip  *  * @return \doctrine\common\collections\arraycollection;  *  */ public function getacccip(){     return $this->acccip; }  /**  * add acccip  *  * @param acccip $acccip;  *   * @return person  *  */    public function addacccip(acccip $acccip)   {     $this->acccip[] = $acccip;     $acccip->setperson($this);     return $this;   }    /**    * remove acccip    *    * @param acccip $acccip;    *    *    */    public function removeacccip(acccip $acccip)   {     $this->acccip->removeelement($acccip);   }    /**    * cartes    *    * @return \doctrine\common\collections\arraycollection    *    */   public function getcartes(){     return $this->cartes;   }    /**    * add carte    *    * @param carte $carte;    *    * @return person    *    */    public function addcarte(carte $carte)   {     $this->cartes[] = $carte;     $carte->setperson($this);     return $this;   }    /**    * remove carte    *    * @param carte $carte;    *    *    */    public function removecarte(carte $carte)   {     $this->cartes->removeelement($carte);   }    /**    * has carte    *     * @return boolean    *     */    public function hascarte()   {     return $this->cartes->count()!=0;   }    /**    * panier    *    * @return \doctrine\common\collections\arraycollection    *    */   public function getpanier(){     return $this->panier;   }    /**    * add panier    *    * @param panier $panier;    *    * @return person    *    */    public function addpanier(panier $panier)   {     $this->panier[] = $panier;     $panier->setperson($this);     return $this;   }    /**    * remove panier    *    * @param panier $panier;    *    *    */    public function removepanier(panier $panier)   {     $this->panier->removeelement($panier);   }    /**    * somme panier    *     * @return float    *     */    public function getsommepanier()   {     $somme=0;     foreach ($this->panier $item){         $somme+=$item->getmontant();     }     return $somme;   }    /**    * transactions    *    * @return \doctrine\common\collections\arraycollection    *    */   public function gettransactions(){     return $this->transactions;   }    /**    * add transaction    *    * @param transactionpaybox $transaction;    *    * @return person    *    */    public function addtransaction(transactionpaybox $transaction)   {     $this->transactions[] = $transaction;     $transaction->setperson($this);     return $this;   }    /**    * remove transaction    *    * @param transactionpaybox $transaction;    *    *    */    public function removetransaction(transactionpaybox $transaction)   {     $this->transactions->removeelement($transaction);   }    /**    * adresses    *    * @return \doctrine\common\collections\arraycollection    *    */   public function getadresses(){     return $this->adresses;   }     /**    * add adresse    *    * @param my\mybundle\entity\adresse $adresse;    *    * @return person    *    */    public function addadresse(adresse $adresse)   {     $this->adresses[] = $adresse;     $adresse->setperson($this);     return $this;   }    /**    * remove adresses    *    * @param my\mybundle\entity\adresse $adresse;    *    *    */    public function removeadresse(adresse $adresse)   {     $this->adresses->removeelement($adresse);   } 

}

sql :

create table "mydb"."person"  (   "no_person" number(8,0),  "cod_civ" varchar2(1 byte),  "first_name" varchar2(30 byte),  "usual_name" varchar2(30 byte),  "last_name" varchar2(20 byte),  "birth_date" date,  "comment" varchar2(300 byte),  "c_user_creation" varchar2(30 byte),  "date_creation" date,  "c_user_modification" varchar2(30 byte),  "date_modification" date,  "email" varchar2(100 byte),  "id_rh" number(8,0),  ) 

edit : more informations. i've changed dates actual type dates (since "string" in previous version (i wasn't developer @ time). when doctrine try create entity, throws exception :

could not convert database value "08/07/92" doctrine type date. expected format: y-m-d 00:00:00  

the dates in database "date" sql's type.

maybe if modify respective column date in value list this:

to_date(?, 'y-m_d 00:00:00')

i'm not sure this. quick thought came mind.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -