本文整理汇总了PHP中Events::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::getErrors方法的具体用法?PHP Events::getErrors怎么用?PHP Events::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::getErrors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$event = new Events();
$event->attributes = $_GET;
if (!isset($_GET['content_id'])) {
$content = Content::model()->findByAttributes(array('slug' => Cii::get($_GET, 'uri', NULL)));
if ($content !== NULL) {
$event->content_id = $content->id;
}
}
if ($event->save()) {
Yii::app()->end();
}
return $this->returnError(400, NULL, $event->getErrors());
}
示例2: execute
public function execute(&$params)
{
$options =& $this->config['options'];
$event = new Events();
$notif = new Notification();
$user = $this->parseOption('user', $params);
$type = $this->parseOption('type', $params);
if ($type === 'auto') {
if (!isset($params['model'])) {
return array(false, '');
}
$notif->modelType = get_class($params['model']);
$notif->modelId = $params['model']->id;
$notif->type = $this->getNotifType();
$event->associationType = get_class($params['model']);
$event->associationId = $params['model']->id;
$event->type = $this->getEventType();
if ($params['model']->hasAttribute('visibility')) {
$event->visibility = $params['model']->visibility;
}
// $event->user = $this->parseOption('user',$params);
} else {
$text = $this->parseOption('text', $params);
$notif->type = 'custom';
$notif->text = $text;
$event->type = 'feed';
$event->subtype = $type;
$event->text = $text;
if ($user == 'auto' && isset($params['model']) && $params['model']->hasAttribute('assignedTo') && !empty($params['model']->assignedTo)) {
$event->user = $params['model']->assignedTo;
} elseif (!empty($user)) {
$event->user = $user;
} else {
$event->user = 'admin';
}
}
if (!$this->parseOption('createNotif', $params)) {
if (!$notif->save()) {
return array(false, array_shift($notif->getErrors()));
}
}
if ($event->save()) {
return array(true, "");
} else {
return array(false, array_shift($event->getErrors()));
}
}
示例3: execute
public function execute(&$params)
{
$options =& $this->config['options'];
$event = new Events();
$notif = new Notification();
$user = $this->parseOption('feed', $params);
$author = $this->parseOption('user', $params);
$type = $this->parseOption('type', $params);
$visibility = $this->parseOption('visibility', $params);
// Unfinsihed automatic event type detection feature
// if($type === 'auto'){
// if(!isset($params['model']))
// return array (false, '');
// $notif->modelType = get_class($params['model']);
// $notif->modelId = $params['model']->id;
// $notif->type = $this->getNotifType();
//
// $event->associationType = get_class($params['model']);
// $event->associationId = $params['model']->id;
// $event->type = $this->getEventType();
// if($params['model']->hasAttribute('visibility'))
// $event->visibility = $params['model']->visibility;
// // $event->user = $this->parseOption('user',$params);
// } else{
$text = $this->parseOption('text', $params);
$notif->type = 'custom';
$notif->text = $text;
$event->type = 'feed';
$event->subtype = $type;
$event->text = $text;
$event->visibility = $visibility;
if ($author == 'auto' && isset($params['model']) && $params['model']->hasAttribute('assignedTo') && !empty($params['model']->assignedTo)) {
$event->user = $params['model']->assignedTo;
} else {
$event->user = $author;
}
if (!empty($user)) {
if ($user == 'auto' && isset($params['model']) && $params['model']->hasAttribute('assignedTo') && !empty($params['model']->assignedTo)) {
$associatedUser = $params['model']->assignedTo;
} else {
$associatedUser = $user;
}
$associatedUser = User::model()->findByAttributes(array('username' => $associatedUser));
if ($associatedUser) {
$event->associationType = 'User';
$event->associationId = $associatedUser->id;
$notif->modelType = 'Profile';
$notif->modelId = $event->associationId;
$notif->type = 'social_post';
$notif->createdBy = $event->user;
$notif->user = $associatedUser->username;
}
}
if (!$this->parseOption('createNotif', $params)) {
if (!$notif->save()) {
$errors = $notif->getErrors();
return array(false, array_shift($errors));
}
}
if ($event->save()) {
return array(true, "");
} else {
$errors = $event->getErrors();
return array(false, array_shift($errors));
}
}