本文整理汇总了PHP中AdminForm::toModel方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminForm::toModel方法的具体用法?PHP AdminForm::toModel怎么用?PHP AdminForm::toModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminForm
的用法示例。
在下文中一共展示了AdminForm::toModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toModel
public function toModel(Model $model, $fields = null, $ignore = null)
{
$model->Permissions = array();
if (!empty($this->controller->request->data['permission_id'])) {
$permissionIds = $this->controller->request->data['permission_id'];
foreach ($permissionIds as $permissionId) {
$model->Permissions[] = new Permission($permissionId);
}
}
return parent::toModel($model, $fields, $ignore);
}
示例2: toModel
public function toModel(Model $model, $fields = null, $ignore = null)
{
if ($model->behaviors->hasBehavior('Flagable')) {
if ($this->hasField('allowComments')) {
$model->setFlag(NodeFlag::ALLOW_COMMENTS, $this->allowComments->value());
}
if ($this->hasField('allowRSS')) {
$model->setFlag(NodeFlag::ALLOW_RSS, $this->allowRSS->value());
}
}
return parent::toModel($model, $fields, $ignore);
}
示例3: toModel
public function toModel(Model $model, $fields = null, $ignore = null)
{
if ($model->behaviors->hasBehavior('Flagable')) {
if ($this->hasField('allowComments')) {
$model->setFlag(BlogPostFlag::ALLOW_COMMENTS, $this->allowComments->value());
}
if ($this->hasField('sticky')) {
$model->setFlag(BlogPostFlag::STICKY, $this->sticky->value());
}
}
// saving tags
$this->Tags = new IndexedArray();
$tags = array_filter(array_unique(preg_split('/\\s+/i', $this->tags->value())));
foreach ($tags as $tag) {
$Tag = new Tag(array('name' => $tag, 'model' => DBQuery::quote($model->name)));
$Tag->set('BlogPostTag', array('model' => DBQuery::quote($model->name)));
$model->Tags[] = $Tag;
}
return parent::toModel($model, $fields, $ignore);
}