Created
April 17, 2014 08:49
-
-
Save jippi/10965881 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/App/Model/Entity/Post.php (line 11) | |
[ | |
'year' => '2014', | |
'month' => '04', | |
'day' => '16', | |
'hour' => '00', | |
'minute' => '00' | |
] | |
Fatal Error | |
Error: Call to a member function format() on a non-object | |
File /var/www/crud3/htdocs/App/Model/Entity/Post.php | |
Line: 11 | |
Notice: If you want to customize this error message, create App/Template/Error/fatal_error.ctp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Model\Entity; | |
class Post extends \Cake\ORM\Entity { | |
public function getCreated() { | |
if (empty($this->_properties['created'])) { | |
return 'N/A'; | |
} | |
//debug($this->_properties['created']);die; | |
return $this->_properties['created']->format('Y-m-d'); | |
} | |
public function getModified() { | |
if (empty($this->_properties['modified'])) { | |
return 'N/A'; | |
} | |
return $this->_properties['modified']->format('Y-m-d'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment