Alright, I will update this as I try to make it run without exception. Might break a few things but thought it can be helpful for newbies like me looking for a better start than yiiblog.
download http://subversion.apache.org/ fire up the cmd
paste the svn command line found in previous post… you should be downloading the codes.
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘post.created’ in ‘order clause’
Change all post
.fieldname
to t
.fieldname
on Controller and Views
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1364 Field ‘created’ doesn’t have a default value
http://www.yiiframework.com/doc/cookbook/10/
http://www.yiiframework.com/doc/api/CTimestampBehavior
in Model
public function behaviors(){
return array(
'ParseCacheBehavior' => array(
'class' => 'ParseCacheBehavior',
'attributes' => array('content'),
),
/* Remove this
'AutoTimestampBehavior' => array(
'class' => 'AutoTimestampBehavior',
'class' => 'application.components.behaviors.AutoTimestampBehavior',
)
*/
//added this codes
'CTimestampBehavior' => array(
'class' => 'zii.behaviors.CTimestampBehavior',
'createAttribute' => 'created',
'updateAttribute' => 'modified',
'setUpdateOnCreate' => true,
)
);
}
When creating a new post
Missing argument 1 for Post::beforeValidate(), called in D:\Domains\altruism.com.my\wwwroot\framework\base\CModel.php on line 147 and defined
//REPLACE
protected function beforeValidate($on) {
if ($this->isNewRecord)
$this->user_id = Yii::app()->user->id;
return parent::beforeValidate($on);
}
//WITH
protected function beforeValidate() {
if ($this->isNewRecord)
$this->user_id = Yii::app()->user->id;
return parent::beforeValidate();
}
Will add more if i get it to run…