-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
95 additions
and
84 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This is a Yii project I am following as I read the book, Agile Web Application Development with | ||
Yii 1.1 ands PHP5 |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
abstract class TrackStarActiveRecord extends CActiveRecord | ||
{ | ||
|
||
/* | ||
* Prepares create_time, create_user_id, update_time and update_user_id attributes before performing validation. | ||
*/ | ||
|
||
protected function beforeValidate() | ||
{ | ||
|
||
//parent:: beforeValidate(); | ||
if($this->isNewRecord) | ||
{ | ||
// set the create date, last updated date and the user doing the creating | ||
$this->create_time=$this->update_time=new CDbExpression('NOW()'); | ||
$this->create_user_id=$this->update_user_id=Yii::app()->user->id; | ||
|
||
} else { | ||
//not a new record, so just set the last updated time and last updated user id | ||
$this->update_time=new CDbExpression('NOW()'); | ||
$this->update_user_id=Yii::app()->user->id; | ||
} | ||
return parent::beforeValidate(); | ||
} | ||
|
||
} | ||
?> |
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
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
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