当前位置: 首页>>代码示例>>PHP>>正文


PHP Person::validate方法代码示例

本文整理汇总了PHP中Person::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::validate方法的具体用法?PHP Person::validate怎么用?PHP Person::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Person的用法示例。


在下文中一共展示了Person::validate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aPerson !== null) {
             if (!$this->aPerson->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPerson->getValidationFailures());
             }
         }
         if (($retval = BoardMemberPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         if ($this->collBoardCommittees !== null) {
             foreach ($this->collBoardCommittees as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:39,代码来源:BaseBoardMember.php

示例2: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aPerson !== null) {
             if (!$this->aPerson->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPerson->getValidationFailures());
             }
         }
         if ($this->aRefSource !== null) {
             if (!$this->aRefSource->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aRefSource->getValidationFailures());
             }
         }
         if ($this->aContactType !== null) {
             if (!$this->aContactType->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aContactType->getValidationFailures());
             }
         }
         if (($retval = ContactPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:42,代码来源:BaseContact.php

示例3: validatePerson

/**
 * Callback function to validate data
 * @return bool must return true or other hooks don't get called
 */
function validatePerson($editPage, $textBox1, $section, &$hookError)
{
    $ns = $editPage->mTitle->getNamespace();
    if ($ns == NS_PERSON) {
        $person = new Person($editPage->mTitle->getText());
        $person->validate($textBox1, $section, $hookError, true);
    }
    return true;
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:13,代码来源:Person.php

示例4: validate

 public function validate($deep = true)
 {
     // call parent
     parent::validate($deep);
     $this->_validator->validate(array('field' => 'Username', 'required' => true, 'minlength' => 2, 'maxlength' => 30, 'errorMessage' => 'Username must be at least two characters long.'));
     $this->_validator->validate(array('field' => 'Username', 'required' => true, 'validator' => 'handle', 'errorMessage' => 'Username can only contain letters, numbers, hyphens, and underscores.'));
     // check handle uniqueness
     if ($this->isDirty && !$this->_validator->hasErrors('Username') && $this->Username) {
         $ExistingUser = User::getByUsername($this->Username);
         if ($ExistingUser && $ExistingUser->ID != $this->ID) {
             $this->_validator->addError('Username', 'Username already registered.');
         }
     }
     $this->_validator->validate(array('field' => 'AccountLevel', 'validator' => 'selection', 'choices' => self::$fields['AccountLevel']['values'], 'required' => false));
     // save results
     return $this->finishValidation();
 }
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:17,代码来源:User.class.php

示例5: actionIndex

 public function actionIndex()
 {
     $this->pageTitle = Lang::t('Register');
     $user_model = new Users(Users::SCENARIO_SIGNUP);
     $user_model->activation_code = Common::generateHash(microtime());
     $user_model->user_level = UserLevels::LEVEL_MEMBER;
     $user_model->timezone = SettingsTimezone::DEFAULT_TIME_ZONE;
     $user_model_class_name = $user_model->getClassName();
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     $person_address = new PersonAddress();
     $person_address_class_name = $person_address->getClassName();
     if (Yii::app()->request->isPostRequest) {
         $verifyPhoneCode = isset($_POST['verifyPhoneCode']) ? $_POST['verifyPhoneCode'] : null;
         $verifyMailCode = isset($_POST['verifyMailCode']) ? $_POST['verifyMailCode'] : null;
         if (isset($_POST[$user_model_class_name])) {
             $user_model->validatorList->add(CValidator::createValidator('CaptchaExtendedValidator', $user_model, 'verifyCode', array('allowEmpty' => !CCaptcha::checkRequirements())));
             $user_model->attributes = $_POST[$user_model_class_name];
             $user_model->status = 'Active';
             $user_model->answer = strtoupper($user_model->answer);
             $user_model->validate();
         }
         if (isset($_POST[$person_model_class_name])) {
             $person_model->attributes = $_POST[$person_model_class_name];
             $person_model->married = 'n';
             $person_model->havechildren = 'n';
             $person_model->validate();
         }
         if (isset($_POST['PersonAddress'])) {
             $person_address->attributes = $_POST[$person_address_class_name];
             $person_address->validate(array('phone1'));
         }
         if (!$user_model->hasErrors() && !$person_model->hasErrors() && !$person_address->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 $person_model->save(FALSE);
                 $person_address->person_id = $person_model->id;
                 $person_address->save(FALSE);
                 Yii::app()->user->setFlash('success', Lang::t('Account created successfullly. Please enter your login details.'));
                 $this->redirect($this->createUrl('/users/default/view', array('id' => $user_model->id)));
                 //$this->redirect('../default/login');
             }
         }
     }
     $this->render('index', array('user_model' => $user_model, 'person_model' => $person_model, 'person_address' => $person_address, 'verifyPhoneCode' => isset($verifyPhoneCode) ? $verifyPhoneCode : null, 'verifyMailCode' => isset($verifyMailCode) ? $verifyMailCode : null));
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:46,代码来源:RegisterController.php

示例6: actionIndex

 public function actionIndex()
 {
     MemberNetwork::model()->updateNetwork(11, 10);
     $this->pageTitle = Lang::t('Register');
     //member model
     $member_model = new Member();
     $member_model_class_name = $member_model->getClassName();
     //user model
     $user_model = new Users(Users::SCENARIO_SIGNUP);
     $user_model->activation_code = Common::generateHash(microtime());
     $user_model->user_level = UserLevels::LEVEL_MEMBER;
     $user_model->timezone = SettingsTimezone::DEFAULT_TIME_ZONE;
     $user_model_class_name = $user_model->getClassName();
     //person model
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     if (Yii::app()->request->isPostRequest) {
         if (isset($_POST[$member_model_class_name])) {
             $member_model->attributes = $_POST[$member_model_class_name];
             $member_model->validate();
         }
         if (isset($_POST[$user_model_class_name])) {
             $user_model->validatorList->add(CValidator::createValidator('CaptchaExtendedValidator', $user_model, 'verifyCode', array('allowEmpty' => !CCaptcha::checkRequirements())));
             $user_model->attributes = $_POST[$user_model_class_name];
             $user_model->validate();
         }
         if (isset($_POST[$person_model_class_name])) {
             $person_model->attributes = $_POST[$person_model_class_name];
             $person_model->validate();
         }
         if (!$member_model->hasErrors() && !$user_model->hasErrors() && !$person_model->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 $person_model->save(FALSE);
                 $member_model->id = $user_model->id;
                 $member_model->save(FALSE);
                 Yii::app()->user->setFlash('success', Lang::t('Check your email for account activation email.'));
                 $this->refresh();
             }
         }
     }
     $this->render('index', array('member_model' => $member_model, 'user_model' => $user_model, 'person_model' => $person_model));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:43,代码来源:RegisterController.php

示例7: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($dept_id = NULL, $user_level = NULL)
 {
     $this->hasPrivilege(Acl::ACTION_CREATE);
     $this->pageTitle = Lang::t('Add ' . $this->resourceLabel);
     //account information
     $user_model = new Users(ActiveRecord::SCENARIO_CREATE);
     $user_model->status = Users::STATUS_ACTIVE;
     $user_model_class_name = $user_model->getClassName();
     //personal information
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     if (Yii::app()->request->isPostRequest) {
         $user_model->attributes = $_POST[$user_model_class_name];
         $person_model->attributes = $_POST[$person_model_class_name];
         $user_model->validate();
         $person_model->validate();
         if (!$user_model->hasErrors() && !$person_model->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 $person_model->save(FALSE);
                 $user_model->updateDeptUser();
                 if (!empty($user_model->dept_id)) {
                     Dept::model()->updateContactPerson($user_model->dept_id, $person_model->id);
                 }
                 Yii::app()->user->setFlash('success', Lang::t('SUCCESS_MESSAGE'));
                 $this->redirect(Controller::getReturnUrl($this->createUrl('view', array('id' => $user_model->id))));
             }
         }
     }
     $user_model->timezone = Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_DEFAULT_TIMEZONE, SettingsTimezone::DEFAULT_TIME_ZONE);
     if (!empty($dept_id)) {
         $user_model->dept_id = $dept_id;
     }
     if (!empty($user_level)) {
         $user_model->user_level = $user_level;
     }
     $this->render('create', array('user_model' => $user_model, 'person_model' => $person_model));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:42,代码来源:DefaultController.php

示例8: actionIndex

 public function actionIndex()
 {
     $personForm = new PersonForm();
     $eventForm = new EventForm();
     $person = null;
     $event = null;
     $tplData = array('personForm' => $personForm, 'eventForm' => $eventForm);
     if (($personFormData = Yii::app()->getRequest()->getPost('PersonForm')) !== null) {
         $personForm->setAttributes($personFormData);
         //var_dump($personForm);
         if ($personForm->validate()) {
             $person = new Person();
             $person->setAttributes(array('name' => $personForm->name, 'gender' => $personForm->gender, 'date' => $personForm->date, 'time' => $personForm->getTime(), 'city_id' => $personForm->city_id));
             /*
                             if($person->validate())
                             {
                $calculator = new Calculator($person);
                // Запуск расчета
                $calculator->run();
                
                $this->calculator = $calculator;
                //var_dump($calculator->chart);
                //$tplData['calculator'] = $calculator; 
                             }
                             else
                             {
                $personForm->addErrors($person->getErrors());
                             }
             * 
             */
         }
     }
     if (($eventFormData = Yii::app()->getRequest()->getPost('EventForm')) !== null) {
         $eventForm->setAttributes($eventFormData);
         if ($eventForm->date != '' || $eventForm->city_id != '' || $eventForm->hour != '' || $eventForm->minute != '') {
             //var_dump($personForm);
             if ($eventForm->validate()) {
                 $event = new Event();
                 $event->setAttributes(array('date' => $eventForm->date, 'time' => $eventForm->getTime(), 'city_id' => $eventForm->city_id));
             }
         }
     }
     if ($person !== null) {
         $validateResult = $person->validate();
         $validateResult = $validateResult && ($event !== null ? $event->validate() : true);
     }
     if ($validateResult) {
         $calculator = new Calculator($person, $event);
         // Запуск расчета
         $calculator->run();
         $this->calculator = $calculator;
         //var_dump($calculator->chart);
         //$tplData['calculator'] = $calculator;
     } else {
         if ($person !== null) {
             $personForm->addErrors($person->getErrors());
         }
         if ($event !== null) {
             $eventForm->addErrors($event->getErrors());
         }
     }
     // Вывод в шаблон
     $this->render('index', $tplData);
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:64,代码来源:CalculatorController.php

示例9: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aPerson !== null) {
             if (!$this->aPerson->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPerson->getValidationFailures());
             }
         }
         if ($this->aPassengerType !== null) {
             if (!$this->aPassengerType->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPassengerType->getValidationFailures());
             }
         }
         if ($this->aRequester !== null) {
             if (!$this->aRequester->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aRequester->getValidationFailures());
             }
         }
         if ($this->aPassengerIllnessCategory !== null) {
             if (!$this->aPassengerIllnessCategory->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPassengerIllnessCategory->getValidationFailures());
             }
         }
         if (($retval = PassengerPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         if ($this->collCampPassengers !== null) {
             foreach ($this->collCampPassengers as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collCompanions !== null) {
             foreach ($this->collCompanions as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissions !== null) {
             foreach ($this->collMissions as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:68,代码来源:BasePassenger.php

示例10: testValidationPass

 public function testValidationPass()
 {
     $person = new Person();
     $person->name = 'Test User';
     $person->description = 'Test description';
     $person->testField = 'test field test';
     $this->assertTrue($person->validate(false));
     $this->assertTrue($person->validateField('name', false));
     $this->assertTrue($person->validateField('testField', false));
     $person->save();
 }
开发者ID:packaged,项目名称:mappers,代码行数:11,代码来源:DoctrineMapperTest.php

示例11: run

 /**
  * Запускаем отрисовку виджета
  *
  * @return void
  */
 public function run()
 {
     // Авторизован ли пользователь
     if (Yii::app()->user->isAuthenticated() === false) {
         return;
     }
     if (($user = Yii::app()->user->getProfile()) === null) {
         return;
     }
     // Загрузка таблицы для блока
     $table = Table::model()->with(array('descriptions'))->findByPK((int) $this->model_id);
     if ($table === null) {
         return;
     }
     // Устанавливаем источники данных
     $person = null;
     $event = null;
     $personForm = new PersonForm();
     $eventForm = new EventForm();
     $description = '';
     if ($table->source_destiny_table == Table::SOURCE_USER) {
         $person = new Person();
         $person->setAttributes(array('name' => $user->profile->name, 'gender' => $user->profile->gender, 'date' => $user->profile->birth_date, 'time' => $user->profile->birth_time, 'city_id' => $user->profile->city_id));
     } elseif ($table->source_destiny_table == Table::SOURCE_ADMIN) {
         $person = $table->person;
     } elseif ($table->source_destiny_table == Table::SOURCE_FROM_USER && ($personFormData = Yii::app()->getRequest()->getPost('PersonForm')) !== null) {
         $personForm->setAttributes($personFormData);
         if ($personForm->validate()) {
             $person = new Person();
             $person->setAttributes(array('name' => $personForm->name, 'gender' => $personForm->gender, 'date' => $personForm->date, 'time' => $personForm->getTime(), 'city_id' => $personForm->city_id));
         }
     }
     if ($table->source_event_table == Table::SOURCE_USER) {
         $event = new Event();
         $event->setAttributes(array('date' => date('Y-m-d'), 'time' => date('H:i'), 'city_id' => $user->profile->city_id));
     } elseif ($table->source_event_table == Table::SOURCE_ADMIN) {
         $event = $table->event;
     } elseif ($table->source_event_table == Table::SOURCE_FROM_USER && ($eventFormData = Yii::app()->getRequest()->getPost('EventForm')) !== null) {
         $eventForm->setAttributes($eventFormData);
         if ($eventForm->date != '' || $eventForm->city_id != '' || $eventForm->hour != '' || $eventForm->minute != '') {
             if ($eventForm->validate()) {
                 $event = new Event();
                 $event->setAttributes(array('date' => $eventForm->date, 'time' => $eventForm->getTime(), 'city_id' => $eventForm->city_id));
             }
         }
     }
     if ($person !== null) {
         $validateResult = $person->validate();
         $validateResult = $validateResult && ($event !== null ? $event->validate() : true);
     }
     if ($validateResult) {
         $calculator = new Calculator($person, $event);
         // Запуск расчета
         $calculator->run();
         if ($table->active_luck_pillar > 0) {
             $calculator->numCurrentLuckColumn = (int) $table->active_luck_pillar;
         }
         // Определяем описание
         $description = $table->description;
     } else {
         if ($person !== null) {
             $personForm->addErrors($person->getErrors());
         }
         if ($event !== null) {
             $eventForm->addErrors($event->getErrors());
         }
     }
     if (Yii::app()->request->isAjaxRequest) {
         $this->controller->renderPartial('//bazi/widgets/TableWidget/_chart', array('model' => $table, 'calculator' => $calculator, 'description' => $description), false, true);
     } else {
         $this->render($this->view, array('model' => $table, 'calculator' => $calculator, 'description' => $description, 'personForm' => $personForm, 'eventForm' => $eventForm));
     }
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:78,代码来源:TableWidget_1.php

示例12: doValidate

 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aPerson !== null) {
             if (!$this->aPerson->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPerson->getValidationFailures());
             }
         }
         if ($this->aWing !== null) {
             if (!$this->aWing->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aWing->getValidationFailures());
             }
         }
         if ($this->aMemberClass !== null) {
             if (!$this->aMemberClass->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMemberClass->getValidationFailures());
             }
         }
         if ($this->aMemberRelatedByMasterMemberId !== null) {
             if (!$this->aMemberRelatedByMasterMemberId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMemberRelatedByMasterMemberId->getValidationFailures());
             }
         }
         if (($retval = MemberPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         if ($this->collApplications !== null) {
             foreach ($this->collApplications as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collAvailabilitys !== null) {
             foreach ($this->collAvailabilitys as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collCoordinators !== null) {
             foreach ($this->collCoordinators as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMembersRelatedByMasterMemberId !== null) {
             foreach ($this->collMembersRelatedByMasterMemberId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMemberWingJobs !== null) {
             foreach ($this->collMemberWingJobs as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissionLegsRelatedByCopilotId !== null) {
             foreach ($this->collMissionLegsRelatedByCopilotId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissionLegsRelatedByBackupCopilotId !== null) {
             foreach ($this->collMissionLegsRelatedByBackupCopilotId as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collPilots !== null) {
             foreach ($this->collPilots as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collPilotAircrafts !== null) {
//.........这里部分代码省略.........
开发者ID:yasirgit,项目名称:afids,代码行数:101,代码来源:BaseMember.php

示例13: actionCreate

 public function actionCreate()
 {
     $this->hasPrivilege(Acl::ACTION_CREATE);
     $this->pageTitle = Lang::t('New ' . $this->resourceAddLabel);
     // User information
     $user_model = new Users(ActiveRecord::SCENARIO_CREATE);
     $user_model->status = Users::STATUS_ACTIVE;
     $user_model_class_name = $user_model->getClassName();
     //personal information
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     //staff information
     $staff_model = new Staff(ActiveRecord::SCENARIO_CREATE);
     $staff_model->status = Staff::STATUS_ACTIVE;
     $staff_model_class_name = $staff_model->getClassName();
     if (Yii::app()->request->isPostRequest) {
         $user_model->attributes = $_POST[$user_model_class_name];
         $person_model->attributes = $_POST[$person_model_class_name];
         $staff_model->attributes = $_POST[$staff_model_class_name];
         $person_model->validate();
         $staff_model->validate();
         $user_model->validate();
         if (!$user_model->hasErrors() && !$staff_model->hasErrors() && !$person_model->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 if ($person_model->save(FALSE)) {
                     $staff_model->person_id = $person_model->id;
                     $staff_model->save(FALSE);
                     Yii::app()->user->setFlash('success', Lang::t('Staff added successfully.'));
                     $this->redirect(Controller::getReturnUrl($this->createUrl('view', array('id' => $staff_model->id))));
                 }
             }
         }
     }
     $this->render('create', array('staff_model' => $staff_model, 'user_model' => $user_model, 'model' => $person_model));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:36,代码来源:DefaultController.php


注:本文中的Person::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。