当前位置: 首页>>代码示例>>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;未经允许,请勿转载。