-
-
Save agborkowski/6057802 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
<?php | |
class Base extends lithium\data\Model { | |
public function save($entity, $data = null, array $options = array()) { | |
if ($data) { | |
$entity->set($data); | |
} | |
if (!$entity->exists()) { | |
$entity->created = new MongoDate(); | |
} | |
$entity->updated = new MongoDate(); | |
return parent::save($entity, null, $options); | |
} | |
} | |
class Posts extends Base { | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment