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


PHP ORM::validate方法代码示例

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


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

示例1: validate

 /**
  * Validates and optionally saves a message log record from an array
  *
  * @param array $array Data to be validated and optionally saved
  * @param bool $save Creates the record in the DB when TRUE
  * @return bool 
  */
 public function validate(array &$array, $save = FALSE)
 {
     // Validation rules for a log entry
     $array = Validation::factory($array)->pre_filter('trim')->add_rules('message_id', 'required')->add_rules('message_sender', 'required')->add_rules('message_type', 'required', 'in_array[0,1]');
     // Pass validation to parent and return
     return parent::validate($array, $save);
 }
开发者ID:uws-eresearch,项目名称:invisiblecity-ushahidi,代码行数:14,代码来源:nexmo_message_log.php

示例2: validate

 /**
  * Specify our rules here so that we have access to the instance of this model.
  */
 public function validate($array = null)
 {
     if (!$array) {
         $this->rules = array("name" => array("rules" => array("required", "length[1,32]"), "callbacks" => array(array($this, "valid_name"))), "flat_rate" => array("rules" => array("required", "decimal")), "per_item" => array("rules" => array("required")));
     }
     parent::validate($array);
 }
开发者ID:Weerwolf,项目名称:gallery3-contrib,代码行数:10,代码来源:postage_band.php

示例3: password_validate

 public function password_validate(Validation $array, $save = FALSE)
 {
     $array->pre_filter('trim');
     $array->add_rules('password', 'required', 'length[7,30]', 'matches[password2]');
     $this->forgotten_password_key = NULL;
     return parent::validate($array, $save);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:7,代码来源:user.php

示例4: validate

 public function validate(Validation $array, $save = false)
 {
     if ($save) {
         $this->logDeterminations($array);
     }
     if (empty($this->submission['fields']['record_status']) && $this->wantToUpdateMetadata) {
         // If we update an occurrence but don't set the verification state, revert it to
         // completed/awaiting verification.
         $array->verified_by_id = null;
         $array->verified_on = null;
         $array->record_status = 'C';
     }
     $array->pre_filter('trim');
     $array->add_rules('sample_id', 'required');
     $array->add_rules('website_id', 'required');
     $fieldlist = $array->as_array();
     if (!array_key_exists('all_info_in_determinations', $fieldlist) || $fieldlist['all_info_in_determinations'] == 'N') {
         $array->add_rules('taxa_taxon_list_id', 'required');
     }
     // Explicitly add those fields for which we don't do validation
     $this->unvalidatedFields = array('comment', 'determiner_id', 'deleted', 'record_status', 'release_status', 'downloaded_flag', 'verified_by_id', 'verified_on', 'confidential', 'all_info_in_determinations', 'external_key', 'zero_abundance', 'last_verification_check_date', 'last_verification_check_taxa_taxon_list_id', 'last_verification_check_version', 'training', 'sensitivity_precision');
     if (array_key_exists('id', $fieldlist)) {
         // existing data must not be set to download_flag=F (final download) otherwise it
         // is read only
         $array->add_rules('downloaded_flag', 'chars[N,I]');
     }
     return parent::validate($array, $save);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:28,代码来源:occurrence.php

示例5: validate

 /**
  * Validates and optionally saves a new level record from an array
  *
  * @param array $array Values to check
  * @param save $save Saves the level record when validation succeeds
  * @return bool
  */
 public function validate(array &$array, $save = FALSE)
 {
     // Setup validation
     $array = Validation::factory($array)->pre_filter('trim')->add_rules('level_title', 'required', 'length[3,80]')->add_rules('level_description', 'required')->add_rules('level_weight', 'required');
     // Pass validation to parent and return
     return parent::validate($array, $save);
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:14,代码来源:level.php

示例6: validate

 /**
  * Specify our rules here so that we have access to the instance of this model.
  */
 public function validate($array = null)
 {
     if (!$array) {
         $this->rules = array("name" => array("rules" => array("required", "length[1,32]"), "callbacks" => array(array($this, "valid_name"))), "description" => array("rules" => array("required", "length[0,255]")), "cost" => array("rules" => array("required", "decimal")));
     }
     parent::validate($array);
 }
开发者ID:ady1503,项目名称:gallery3-contrib,代码行数:10,代码来源:product.php

示例7: validate

 /**
  * Validates and optionally saves a form field record from an array
  *
  * @param array $array Values to check
  * @param bool $save Save the record when validation suceeds
  * @return bool
  */
 public function validate(array &$array, $save = FALSE)
 {
     // Setup validation
     $array = Validation::factory($array)->pre_filter('trim', TRUE)->add_rules('form_id', 'required', 'numeric', array('Form_Model', 'is_valid_form'))->add_rules('field_type', 'required', 'numeric')->add_rules('field_name', 'required', 'length[1,1000]')->add_rules('field_required', 'required', 'between[0,1]')->add_rules('field_ispublic_visible', 'required', 'numeric')->add_rules('field_ispublic_submit', 'required', 'numeric');
     // Get the field type
     $array->field_isdate = $array->field_type == 3 ? 1 : 0;
     // Ensure that checkboxes and radio buttons have a default value
     if ($array->field_type == 5 or $array->field_type == 6 or $array->field_type == 7) {
         $array->add_rules('field_default', 'required', 'standard_text');
     }
     // Check if field width and height have been specified
     if (!empty($array->field_width)) {
         $array->add_rules('field_width', 'between[0,300]');
     }
     if (!empty($array->field_height)) {
         $array->add_rules('field_height', 'between[0,50]');
     }
     if (!empty($array->field_default)) {
         $array->add_rules('field_default', 'length[1,10000]');
     }
     // If date field, and default value is not empty, add date validation rules
     if (!empty($array->field_default) and !empty($array->field_isdate)) {
         $array->add_rules('field_default', array('valid', 'date_mmddyyyy'));
     }
     // Return
     return parent::validate($array, $save);
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:34,代码来源:form_field.php

示例8: validate

 public function validate(Validation $array, $save = FALSE)
 {
     $array->pre_filter('trim');
     $array->add_rules('title', 'required');
     $this->unvalidatedFields = array('code', 'abbreviation', 'description', 'category_id', 'deleted');
     return parent::validate($array, $save);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:7,代码来源:taxon_designation.php

示例9: validate

 public function validate(Validation $array, $save = FALSE)
 {
     $array->pre_filter('trim');
     $array->add_rules('term', 'required');
     $array->add_rules('language_id', 'required');
     return parent::validate($array, $save);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:7,代码来源:term.php

示例10: validate

 public function validate(Validation $array, $save = FALSE)
 {
     // uses PHP trim() to remove whitespace from beginning and end of all fields before validation
     $array->pre_filter('trim');
     $this->unvalidatedFields = array('user_id', 'website_id', 'site_role_id');
     return parent::validate($array, $save);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:7,代码来源:users_website.php

示例11: validate

 public function validate(Validation $array, $save = FALSE)
 {
     $array->pre_filter('trim');
     $array->add_rules('taxon_id', 'required');
     $array->add_rules('taxon_designation_id', 'required');
     $this->unvalidatedFields = array('start_date', 'source', 'geographical_constraint', 'deleted');
     return parent::validate($array, $save);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:8,代码来源:taxa_taxon_designation.php

示例12: validate

 public function validate(Validation $array, $save = FALSE)
 {
     $array->pre_filter('trim');
     $array->add_rules('group_id', 'required');
     $array->add_rules('user_id', 'required');
     $this->unvalidatedFields = array('administrator', 'deleted', 'pending');
     return parent::validate($array, $save);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:8,代码来源:groups_user.php

示例13: validate

 public function validate(Validation $array, $save = FALSE)
 {
     $array->pre_filter('trim');
     $array->add_rules('group_id', 'required');
     $array->add_rules('location_id', 'required');
     $this->unvalidatedFields = array('deleted');
     return parent::validate($array, $save);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:8,代码来源:groups_location.php

示例14: validate

 /**
  * Specify our rules here so that we have access to the instance of this model.
  */
 public function validate(Validation $array = null)
 {
     // validate() is recursive, only modify the rules on the outermost call.
     if (!$array) {
         $this->rules = array("admin" => array("callbacks" => array(array($this, "valid_admin"))), "email" => array("rules" => array("length[1,255]", "valid::email"), "callbacks" => array(array($this, "valid_email"))), "full_name" => array("rules" => array("length[0,255]")), "locale" => array("rules" => array("length[2,10]")), "name" => array("rules" => array("length[1,32]", "required"), "callbacks" => array(array($this, "valid_name"))), "password" => array("callbacks" => array(array($this, "valid_password"))), "url" => array("rules" => array("valid::url")));
     }
     parent::validate($array);
 }
开发者ID:andyst,项目名称:gallery3,代码行数:11,代码来源:user.php

示例15: validate

 public function validate(Validation $array, $save = FALSE)
 {
     // uses PHP trim() to remove whitespace from beginning and end of all fields before validation
     $array->pre_filter('trim');
     $array->add_rules('title', 'required', 'length[1,10]');
     $this->unvalidatedFields = array('deleted');
     return parent::validate($array, $save);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:8,代码来源:title.php


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