Пример #1
0
 /**
  * 模型初始化
  */
 public function initialize()
 {
     parent::initialize();
     //关联users表
     $this->belongsTo("author_id", "Blog\\Models\\Users", "id", array('alias' => 'Author'));
     $this->hasMany("id", "Blog\\Models\\Answers", "question_id", array('alias' => 'Answers'));
     $this->belongsTo("type_id", "Blog\\Models\\Types", "id", array('alias' => 'Type'));
 }
Пример #2
0
 /**
  * 模型初始化
  */
 public function initialize()
 {
     parent::initialize();
     //关联users表
     $this->belongsTo("author_id", "Blog\\Models\\Users", "id", array('alias' => 'Author'));
     $this->belongsTo("type_id", "Blog\\Models\\Types", "id", array('alias' => 'Type'));
     $this->hasMany("id", "Blog\\Models\\Comments", "target_id", array('alias' => 'Comments'));
     $this->skipAttributesOnUpdate(array('author_id', 'class'));
     $this->skipAttributesOnCreate(array('status'));
 }
Пример #3
0
 /**
  * 修改用户信息
  * @see \Blog\Models\BaseModel::beforeUpdate()
  */
 public function beforeUpdate()
 {
     parent::beforeUpdate();
 }