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


PHP Condition::add方法代码示例

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


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

示例1: testValidateOperator

 function testValidateOperator()
 {
     $c = new Condition();
     $c->add('foo', 'bar', 'SQL injection!');
     $this->setExpectedException('InvalidArgumentException');
     $stmnt = $c->getQueryStatement();
     $stmnt->setConnection(DBManager::getConnection());
 }
开发者ID:abcarroll,项目名称:DABL,代码行数:8,代码来源:ConditionTest.php

示例2: testToArray

 public function testToArray()
 {
     $con = new Condition();
     $con->add('id', '=', '1');
     $this->assertEquals(array(array(Condition::COLUMN => 'id', Condition::OPERATOR => '=', Condition::VALUE => '1', Condition::CONJUNCTION => 'AND', Condition::TYPE => Condition::TYPE_SCALAR)), $con->toArray());
 }
开发者ID:seytar,项目名称:psx,代码行数:6,代码来源:ConditionTest.php

示例3: processImportConditions

 public function processImportConditions($conditions, $id_lang)
 {
     foreach ($conditions as $condition) {
         try {
             if (Condition::getIdByIdPs($condition->id_ps_condition)) {
                 continue;
             }
             //only add new condition, if already exist we continue
             $cond = new Condition();
             $cond->hydrate((array) $condition, (int) $id_lang);
             $time = 86400;
             if ($cond->calculation_type == 'time') {
                 $time = 86400 * (int) $cond->calculation_detail;
             }
             $cond->date_upd = date('Y-m-d H:i:s', time() - $time);
             $cond->date_add = date('Y-m-d H:i:s');
             $condition->calculation_detail = trim($condition->calculation_detail);
             $cond->add(false);
             if ($condition->calculation_type == 'hook' && !$this->isRegisteredInHook($condition->calculation_detail) && Validate::isHookName($condition->calculation_detail)) {
                 $this->registerHook($condition->calculation_detail);
             }
             unset($cond);
         } catch (Exception $e) {
             continue;
         }
     }
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:27,代码来源:gamification.php

示例4: find_events

 public function find_events(&$Model, $event_type, $user, $from, $to, $options)
 {
     if (is_numeric($from)) {
         $from = date('Y-m-d H:i:s', $from);
     }
     if (is_numeric($to)) {
         $to = date('Y-m-d H:i:s', $to);
     }
     $provider_options = $this->settings[$event_type][$Model->alias];
     if (empty($provider_options)) {
         return $this->cakeError('error', array('message' => "Can not provide {$event_type} events."));
     }
     $scope_options = array();
     $cond = new Condition();
     if ($from && $to) {
         $cond->add(array($provider_options['timestamp'] . " BETWEEN ? AND ?" => array($from, $to)));
     }
     if (isset($options['author'])) {
         if (empty($provider_options['author_key'])) {
             return array();
         }
         $cond->add(array($provider_options['author_key'] => $options['author']['id']));
     }
     if (isset($provider_options['permission'])) {
         $project =& ClassRegistry::init('Project');
         $cond->add($project->allowed_to_condition($user, $provider_options['permission'], $options));
     }
     $scope_options['conditions'] = $cond->conditions;
     $scope_options['order'] = $Model->alias . ".id DESC";
     if (isset($options['limit']) && $options['limit'] > 1) {
         // id and creation time should be in same order in most cases
         $scope_options['limit'] = $options['limit'];
     }
     if (isset($provider_options['include']) && !(array_key_exists('CustomField', $provider_options['include']) || in_array('CustomField', $provider_options['include']))) {
         $Model->_customFieldAfterFindDisable = false;
     }
     $values = $Model->find('all', array_merge_recursive($provider_options['find_options'], $scope_options));
     $ret = array();
     list($mname, $cname) = explode('.', $provider_options['timestamp']);
     $_ids = array();
     foreach ($values as $value) {
         if (in_array($value[$mname][$Model->primaryKey], $_ids)) {
             continue;
         }
         $_ids[] = $value[$mname][$Model->primaryKey];
         $time = strtotime($value[$mname][$cname]);
         $day = strtotime(date('Y-m-d 00:00:00', strtotime($value[$mname][$cname])));
         if (!isset($ret[$day])) {
             $ret[$day] = array();
         }
         if (!isset($ret[$day][$time])) {
             $ret[$day][$time] = array();
         }
         $ret[$day][$time][] = $value;
     }
     return $ret;
 }
开发者ID:gildonei,项目名称:candycane,代码行数:57,代码来源:ActivityProviderBehavior.php


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