Doctrine2Fatal error: Call to a member function format() on a non-object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manjava
    New Member
    • Sep 2009
    • 132

    Doctrine2Fatal error: Call to a member function format() on a non-object

    I have the Fields the Type DATETIME and Other DATE but when i INSERT NULL I have This Error : on controller i set that :
    Code:
    $data ['dateCreation']        = $tab['dateCrea'];
    Code:
    $tab['dateCrea'] somtimes NULL other Times 123614 or 21/12/2014 21:05:00 or others time
    in Entity I do That

    Code:
    public function setModificationdate($modificationdate)
        {
            $this->modificationdate = new \DateTime($modificationdate);
    
            return $this;
        }
    Fatal error: Call to a member function format() on a non-object in C:\wamp\www\imp rimvert\vendor\ doctrine\dbal\l ib\Doctrine\DBA L\Types\DateTyp e.php on line 53
    How can i resolve that
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    How can i resolve that
    do not insert NULL values.

    if the field allows NULL values, you have to somehow pass the NULL data type in doctrine as well (instead of the date/datetime data type).

    Comment

    • manjava
      New Member
      • Sep 2009
      • 132

      #3
      so i get the data dynamically sometimes date sometimes contains 2000 or others but always i get this error

      Comment

      Working...