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


PHP ORM::check方法代码示例

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


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

示例1: check

 public function check()
 {
     if (!parent::check()) {
         return FALSE;
     }
     if (count($this->_transactions['incomes']) == 0 and count($this->_transactions['transfers']) == 0 and count($this->_transactions['expenses']) == 0) {
         $this->_validate->error('balance', 'No transactions');
         return FALSE;
     }
     $balance = 0;
     foreach ($this->_transactions as $type => $transactions) {
         switch ($type) {
             case 'incomes':
                 foreach ($transactions as $transaction) {
                     $balance += $transaction->amount;
                 }
                 break;
             default:
                 foreach ($transactions as $transaction) {
                     $balance -= $transaction->amount;
                 }
         }
     }
     if ($balance != 0) {
         $this->_validate->error('balance', 'Not zero');
         return FALSE;
     }
     return TRUE;
 }
开发者ID:asanoturna,项目名称:moni,代码行数:29,代码来源:movement.php

示例2: validate

 /**
  * Validates and optionally
  *
  * @param  array    values to check
  * @param  boolean  save the record when validation succeeds
  * @return boolean
  */
 public function validate()
 {
     $this->_filters += array(TRUE => array('trim' => array()));
     #array($this, 'email_available')=>array()
     $this->_rules += array('email' => array('min_length' => array(4), 'max_length' => array(255), 'email' => array()));
     # array($this, 'user_name_available')
     $this->_rules += array('user_name' => array('min_length' => array(4), 'max_length' => array(255), 'alpha_dash' => array()));
     return parent::check();
 }
开发者ID:jimktrains,项目名称:rccms,代码行数:16,代码来源:user.php

示例3: validate

 public function validate()
 {
     $this->_filters += array(TRUE => array('trim' => array()));
     $this->_rules = array('password' => array('min_length' => array(6)));
     if (isset($this->password_confirm)) {
         $this->_rules += array('password_confirm' => array('matches' => array('password')));
     }
     return parent::check();
 }
开发者ID:jimktrains,项目名称:rccms,代码行数:9,代码来源:local.php

示例4: check

 public function check()
 {
     if (!isset($this->_validate)) {
         // Initialize the validation object
         $this->_validate();
     }
     // add custom rules to $this->_validate();
     event::run('yuriko_core.model.validate.site_settings', $this->_validate);
     return parent::check();
 }
开发者ID:Zeelot,项目名称:yuriko_cms,代码行数:10,代码来源:setting.php

示例5: populate

 /**
  * @return bool
  */
 public function populate()
 {
     if (!$this->allowed('write')) {
         return FALSE;
     }
     $hash = $this->_hash_input_name;
     // nothing or the other form has been submitted
     if (!isset($_POST[$hash])) {
         return FALSE;
     }
     $values = array();
     foreach ($this as $name => $field) {
         if ($field->allowed('write')) {
             if (!is_null($value = Arr::get($_POST, $name))) {
                 $values[$name] = $field->prepare_to_populate($value);
             }
         }
     }
     $this->_object->values($values);
     foreach ($this as $name => $field) {
         $field->set_value($this->_object->{$name});
     }
     $valid = $this->_object->check();
     foreach ($this as $name => $field) {
         $valid = ($valid and $field->validate($this->_object->validate(), $name));
     }
     if ($valid) {
         return TRUE;
     }
     $errors = $this->_object->validate()->errors($this->_messages_file);
     foreach ($errors as $name => $error) {
         if (isset($this[$name])) {
             $this[$name]->set_error($error);
         }
     }
     return FALSE;
 }
开发者ID:ariol,项目名称:adminshop,代码行数:40,代码来源:Orm.php

示例6: check

 /**
  * Check user throttle status.
  *
  * @param \Validation $extra_validation
  * @return bool
  * @throws \Cartalyst\Sentry\Throttling\UserBannedException
  * @throws \Cartalyst\Sentry\Throttling\UserSuspendedException
  */
 public function check(\Validation $extra_validation = NULL)
 {
     if ($this->isBanned()) {
         throw new UserBannedException(sprintf('User [%s] has been banned.', $this->getUser()->getLogin()));
     } else {
         if ($this->isSuspended()) {
             throw new UserSuspendedException(sprintf('User [%s] has been suspended.', $this->getUser()->getLogin()));
         }
     }
     return parent::check($extra_validation);
 }
开发者ID:shomimn,项目名称:builder,代码行数:19,代码来源:Throttle.php

示例7: check

 /**
  * Sync field values with
  * @param Validation $extra_validation
  * @todo Clean this up and enable error passing directly to fields
  */
 public function check(Validation $extra_validation = NULL)
 {
     $ex = NULL;
     $errors = array();
     // Reapply filters by setting objects again
     foreach ($this->table_columns() as $column => $definition) {
         if ($column == $this->primary_key()) {
             continue;
         }
         $this->{$column} = $this->{$column};
     }
     try {
         parent::check($extra_validation);
     } catch (ORM_Validation_Exception $ex) {
         $errors = $ex->errors('models', TRUE);
     }
     // After applying filters, set field values back.
     foreach ($this->_z_fields as $column => $field) {
         $field->value = $this->{$column};
         $field->error = Arr::get($errors, $column);
     }
     // Rethrow exception
     if ($ex instanceof ORM_Validation_Exception) {
         throw $ex;
     }
 }
开发者ID:Zahymaka,项目名称:ZForm,代码行数:31,代码来源:zform.php


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