Skip to content

Instantly share code, notes, and snippets.

@agborkowski
Forked from notomato/gist:3376880
Created July 22, 2013 21:19
Show Gist options
  • Save agborkowski/6057802 to your computer and use it in GitHub Desktop.
Save agborkowski/6057802 to your computer and use it in GitHub Desktop.
<?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