本文整理汇总了PHP中BaseModel::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::initialize方法的具体用法?PHP BaseModel::initialize怎么用?PHP BaseModel::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseModel
的用法示例。
在下文中一共展示了BaseModel::initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* 模型初始化
*/
public function initialize()
{
parent::initialize();
//关联users表
$this->belongsTo("author_id", "Blog\\Models\\Users", "id", array('alias' => 'Author'));
$this->belongsTo("question_id", "Blog\\Models\\Questions", "id", array('alias' => 'Question'));
}
示例2: initialize
/**
* 模型初始化
*/
public function initialize()
{
parent::initialize();
//关联users表
$this->belongsTo("author_id", "Blog\\Models\\Users", "id", array('alias' => 'Author'));
$this->skipAttributesOnUpdate(array('author_id', 'target_id', 'type'));
}
示例3: initialize
public function initialize()
{
parent::initialize();
$this->setSource('book_instances');
$this->belongsTo('book_id', "App\\Models\\Book", 'id', ["alias" => "book"]);
$this->belongsTo('user_id', "App\\Models\\User", 'id', ["alias" => "user"]);
}
示例4: initialize
public function initialize()
{
parent::initialize();
$database = new Elements();
$database = $database->getDatabase();
$this->setConnectionService($database);
}
示例5: initialize
/**
* 模型初始化
*/
public function initialize()
{
parent::initialize();
//关联users表
$this->belongsTo("author_id", "Blog\\Models\\Users", "id", array('alias' => 'Author'));
$this->belongsTo("target_id", "Blog\\Models\\Users", "id", array('alias' => 'Target'));
$this->belongsTo("comment_id", "Blog\\Models\\Comments", "id", array('alias' => 'Comment'));
}
示例6: initialize
/**
* 模型初始化
*/
public function initialize()
{
parent::initialize();
//关联users表
$this->belongsTo("author_id", "Blog\\Models\\Users", "id", array('alias' => 'Author'));
//关联articles表
$this->belongsTo("target_id", "Blog\\Models\\Articles", "id", array('alias' => 'Article'));
$this->hasMany("id", "Blog\\Models\\Replies", "comment_id", array('alias' => 'Replies'));
}
示例7: initialize
public function initialize()
{
parent::initialize();
$this->hasMany('id', 'ST\\Common\\Models\\BookComment', 'uid', ['alias' => 'bookComment']);
$this->belongsTo('school_id', 'ST\\Common\\Models\\School', 'id', ['alias' => 'school']);
$this->belongsTo('classes_id', 'ST\\Common\\Models\\Classes', 'id', ['alias' => 'classes']);
}
示例8: initialize
public function initialize()
{
parent::initialize();
$this->hasMany('id', 'ST\\Common\\Models\\Book', 'cid', ['alias' => 'book']);
}
示例9: initialize
public function initialize()
{
parent::initialize();
$this->table = $this->prefix . $this->table;
}
示例10: initialize
public function initialize()
{
parent::initialize();
$this->belongsTo('classes_id', 'ST\\Common\\Models\\Classes', 'id', ['alias' => 'classes']);
}
示例11: initialize
public function initialize()
{
parent::initialize();
$this->belongsTo('book_id', 'ST\\Common\\Models\\Book', 'id', ['alias' => 'book']);
$this->belongsTo('uid', 'ST\\Common\\Models\\User', 'id', ['alias' => 'user']);
$this->belongsTo('classes_id', 'ST\\Common\\Models\\Classes', 'id', ['alias' => 'classes']);
$this->hasMany('id', 'ST\\Common\\Models\\Note', 'read_task_id', ['alias' => 'note']);
}
示例12: initialize
public function initialize()
{
parent::initialize();
$this->belongsTo('eva_task_id', 'ST\\Common\\Models\\EvaTask', 'id', ['alias' => 'eva_task']);
$this->belongsTo('uid', 'ST\\Common\\Models\\User', 'id', ['alias' => 'user']);
$this->belongsTo('book_id', 'ST\\Common\\Models\\Book', 'id', ['alias' => 'book']);
$this->belongsTo('classes_id', 'ST\\Common\\Models\\Classes', 'id', ['alias' => 'classes']);
$this->belongsTo('read_task_id', 'ST\\Common\\Models\\Task', 'id', ['alias' => 'task']);
}
示例13: initialize
/**
* 模型初始化
*/
public function initialize()
{
parent::initialize();
//关联users表
$this->hasMany("id", "Blog\\Models\\Articles", "type_id", array('alias' => 'Articles'));
}
示例14: initialize
/**
* 模型初始化
*/
public function initialize()
{
parent::initialize();
$this->skipAttributesOnCreate(array('status'));
}
示例15: initialize
public function initialize()
{
parent::initialize();
//多本书对一个分类
$this->belongsTo('cid', 'ST\\Common\\Models\\BookCate', 'id', ['alias' => 'bookCate']);
//一本书有多个评论
$this->hasMany('id', 'ST\\Common\\Models\\BookComment', 'book_id', ['alias' => 'bookComment']);
$this->belongsTo('uid', 'ST\\Common\\Models\\User', 'id', ['alias' => 'user']);
}