本文整理汇总了PHP中CGroup::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP CGroup::validate方法的具体用法?PHP CGroup::validate怎么用?PHP CGroup::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGroup
的用法示例。
在下文中一共展示了CGroup::validate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
public function actionCreate()
{
$model = new CGroup();
$description = new CGroupDescription();
$this->performAjaxValidation(array($model, $description), 'cgroup-form');
if (isset($_POST['CGroupDescription'])) {
//$model->setAttributes($_POST[$this->modelName]);
$description->setAttributes($_POST[$this->modelName . 'Description']);
$suc = Yii::t('info', 'CGroup was successfully created');
$err = Yii::t('info', 'Could not update CGroup');
$description->c_group_id = 0;
$description->locale_code = Yii::app()->getLanguage();
if ($model->validate() && $description->validate()) {
if ($model->save()) {
$description->c_group_id = $model->id;
$description->save();
Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc);
if (Yii::app()->getRequest()->getIsAjaxRequest()) {
$this->renderPartial('_view', array('model' => $model, 'description' => $description), false, true);
Yii::app()->end();
} else {
$this->redirect(array('view', 'id' => $model->id));
}
} else {
Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err);
}
} else {
$description->validate();
}
UtilityHelper::sendToLog($model->getErrors());
UtilityHelper::sendToLog($description->getErrors());
}
if (Yii::app()->getRequest()->getIsAjaxRequest()) {
$this->renderPartial('_form', array('model' => $model, 'description' => $description), false, true);
Yii::app()->end();
}
$this->render('create', array('model' => $model, 'description' => $description));
}
示例2: createGroup
/**
* @param CGroup $oGroup
*
* @return bool
*/
public function createGroup($oGroup)
{
$bResult = false;
try {
if ($oGroup->validate()) {
$bResult = $this->oStorage->createGroup($oGroup);
}
} catch (CApiBaseException $oException) {
$bResult = false;
$this->setLastException($oException);
}
return $bResult;
}