本文整理汇总了PHP中Schedule::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Schedule::getErrors方法的具体用法?PHP Schedule::getErrors怎么用?PHP Schedule::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schedule
的用法示例。
在下文中一共展示了Schedule::getErrors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
public function actionCreate()
{
$model = new Schedule();
$model2 = new ProfessorCourse();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Schedule'])) {
$sql = '
select sem.end_Date from professor_course pc join courses co on pc.course_Id = co.course_Id
join semesters sem on sem.semester_Id = co.semester_Id where professor_Course_Id = "' . $_POST['Schedule']['professor_Course_Id'] . '" ;
';
$row1Class = Yii::app()->db->createCommand($sql)->queryRow();
$sql2 = '
select day from class_type where class_Type_Id = "' . $_POST['Schedule']['class_Type_Id'] . '" ;
';
$row2Class = Yii::app()->db->createCommand($sql2)->queryRow();
$endDate = $row1Class['end_Date'];
$dayNameEndDate = $row2Class['day'];
$date = date('Y-m-d');
while ($date != $endDate) {
$dayName = date('l', strtotime($date));
if ($dayName == $dayNameEndDate) {
$model = new Schedule();
$model->date = $date;
$model->attributes = $_POST['Schedule'];
// other fileds if they are not getting assigned
if (!$model->save()) {
echo '<pre>';
print_r($model->getErrors());
echo '</pre>';
exit;
}
}
$date = strtotime("+1 day", strtotime($date));
$date = date("Y-m-d", $date);
}
$this->redirect(array('index'));
}
$this->render('_Form2', array('model' => $model, 'model2' => $model2));
}
示例2: afterSave
protected function afterSave()
{
parent::afterSave();
if ($this->isNewRecord) {
$this->position->group_id = $this->id;
$this->position->code = $this->code;
$this->position->update();
$time = explode(',', $this->time);
$tCount = count($time);
$j = 0;
$k = 0;
for ($i = 0; $i < $this->number; $i++) {
if ($j == $tCount) {
$j = 0;
$k++;
}
$schedule = new Schedule();
$schedule->group_id = $this->id;
$schedule->number = $i + 1;
$schedule->teacher_id = $this->teacher_id;
$schedule->start_time = str_replace(" ", "T", date('Y-m-d H:i:s', strtotime("+" . $k . "week", strtotime($time[$j]))));
if ($this->hui == "on") {
$pizda = 30;
} else {
$pizda = 0;
}
$schedule->end_time = str_replace(" ", "T", date('Y-m-d H:i:s', strtotime("+" . $k . "week 1 hours " . $pizda . " minutes", strtotime($time[$j]))));
//die(var_dump($this->branch_id));
$schedule->room_id = $this->findRoom($schedule->start_time, $this->branch_id, count($this->positions));
if (!$schedule->save()) {
die(var_dump($schedule->getErrors()));
}
$j++;
}
}
}