Difference between #7 and #8 of
How to automate timestamps in ActiveRecord models

Revision #8 has been created by nye.cat on Jun 15, 2011, 6:04:44 PM with the memo:

Deleted 'else' in the beforeSave Example
« previous (#7) next (#9) »

Changes

Title unchanged

How to automate timestamps in ActiveRecord models

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

[...]
[php]
public function beforeSave() {
if ($this->isNewRecord)
$this->created = new CDbExpression('NOW()');
else $this->modified = new CDbExpression('NOW()'); return parent::beforeSave(); } These are simple and elegant solutions to this issue.
25 0
35 followers
Viewed: 153 946 times
Version: 1.1
Category: Tutorials
Tags:
Written by: dalip
Last updated by: Yang He
Created on: Feb 14, 2009
Last updated: 5 years ago
Update Article

Revisions

View all history