當前位置: 首頁>>代碼示例>>PHP>>正文


PHP fORM::callHookCallbacks方法代碼示例

本文整理匯總了PHP中fORM::callHookCallbacks方法的典型用法代碼示例。如果您正苦於以下問題:PHP fORM::callHookCallbacks方法的具體用法?PHP fORM::callHookCallbacks怎麽用?PHP fORM::callHookCallbacks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fORM的用法示例。


在下文中一共展示了fORM::callHookCallbacks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validate

 /**
  * Validates the values of the record against the database and any additional validation rules
  * 
  * @throws fValidationException  When the record, or one of the associated records, violates one of the validation rules for the class or can not be properly stored in the database
  * 
  * @param  boolean $return_messages      If an array of validation messages should be returned instead of an exception being thrown
  * @param  boolean $remove_column_names  If column names should be removed from the returned messages, leaving just the message itself
  * @return void|array  If $return_messages is TRUE, an array of validation messages will be returned
  */
 public function validate($return_messages = FALSE, $remove_column_names = FALSE)
 {
     $class = get_class($this);
     if (fORM::getActiveRecordMethod($class, 'validate')) {
         return $this->__call('validate', array($return_messages));
     }
     $validation_messages = array();
     fORM::callHookCallbacks($this, 'pre::validate()', $this->values, $this->old_values, $this->related_records, $this->cache, $validation_messages);
     // Validate the local values
     $local_validation_messages = fORMValidation::validate($this, $this->values, $this->old_values);
     // Validate related records
     $related_validation_messages = fORMValidation::validateRelated($this, $this->values, $this->related_records);
     $validation_messages = array_merge($validation_messages, $local_validation_messages, $related_validation_messages);
     fORM::callHookCallbacks($this, 'post::validate()', $this->values, $this->old_values, $this->related_records, $this->cache, $validation_messages);
     $validation_messages = fORMValidation::replaceMessages($class, $validation_messages);
     $validation_messages = fORMValidation::reorderMessages($class, $validation_messages);
     if ($return_messages) {
         if ($remove_column_names) {
             $validation_messages = fValidationException::removeFieldNames($validation_messages);
         }
         return $validation_messages;
     }
     if (!empty($validation_messages)) {
         throw new fValidationException('The following problems were found:', $validation_messages);
     }
 }
開發者ID:mrjwc,項目名稱:printmaster,代碼行數:35,代碼來源:fActiveRecord.php


注:本文中的fORM::callHookCallbacks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。