Skip to content

Instantly share code, notes, and snippets.

@jippi
Created April 17, 2014 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jippi/10965881 to your computer and use it in GitHub Desktop.
Save jippi/10965881 to your computer and use it in GitHub Desktop.
/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
<?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