public function create($data = array()) { parent::create($data); if ($this->newDoc) { $this->set('createdon', time()); } return $this; }
public function __construct($modx, $debug = false) { parent::__construct($modx, $debug); if (empty($this->default_field)) { $data = $this->modx->db->getTableMetaData($this->makeTable($this->table)); foreach ($data as $item) { if (empty($this->pkName) && $item['Key'] == 'PRI') { $this->pkName = $item['Field']; } if ($this->pkName != $item['Field']) { $this->default_field[$item['Field']] = $item['Default']; } } $this->generateField = true; } }
public function create($data = array()) { parent::create($data); $this->set('createdby', null)->set('editedby', null)->set('createdon', time())->touch(); return $this; }