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


PHP Criteria::clear方法代码示例

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


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

示例1: executeStats

 public function executeStats()
 {
     $stats = array();
     $c = new Criteria();
     // readers_cnt
     $date = date('Y-m-d', strtotime('-1 day'));
     $c->clear();
     $c->add(ReaderPeer::DATE, $date);
     $readers = ReaderPeer::doSelectOne($c);
     $cnt = $readers ? $readers->getCnt() : 0;
     $tcnt = $cnt % 100;
     $str = '';
     if ($tcnt == 1) {
         $str = 'osoba';
     } else {
         if ($tcnt >= 12 && $tcnt <= 14) {
             $str = 'osób';
         } else {
             if ($tcnt % 10 > 1 && $tcnt % 10 < 5) {
                 $str = 'osoby';
             } else {
                 $str = 'osób';
             }
         }
     }
     $stats['reader_cnt'] = $cnt == 0 ? 'brak danych' : sprintf('%d %s', $cnt, $str);
     // blog_cnt
     $c->clear();
     $c->add(BlogPeer::APPROVED, true);
     $stats['blog_cnt'] = BlogPeer::doCount($c);
     // post_cnt
     $c->clear();
     $c->add(PostPeer::DELETED, false);
     $stats['post_cnt'] = PostPeer::doCount($c);
     // month_avg
     $c->clear();
     $c->addAscendingOrderByColumn(PostPeer::CREATED_AT);
     $post = PostPeer::doSelectOne($c);
     $ots = $post ? $post->getCreatedAt(null) : time();
     $years = date('Y') - date('Y', $ots);
     $months = $years * 12 + (date('n') - date('n', $ots));
     $stats['month_avg'] = $months > 0 ? round($stats['post_cnt'] / $months) : 0;
     // assign
     $this->stats = $stats;
 }
开发者ID:noose,项目名称:Planeta,代码行数:45,代码来源:components.class.php

示例2: clear

 /**
  * Clear the conditions to allow the reuse of the query object.
  * The ModelCriteria's Model and alias 'all the properties set by construct) will remain.
  *
  * @return ModelCriteria The primary criteria object
  */
 public function clear()
 {
     parent::clear();
     $this->with = array();
     $this->primaryCriteria = null;
     $this->formatter = null;
     return $this;
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:14,代码来源:ModelCriteria.php

示例3: getAllRolesFilter

 function getAllRolesFilter($start, $limit, $filter = '')
 {
     //echo $start.'<<<<'.$limit;
     $systemCode = 'PROCESSMAKER';
     $oCriteria2 = new Criteria('rbac');
     $result = array();
     $oCriteria2->addSelectColumn('COUNT(*) AS CNT');
     $oCriteria2->add(RolesPeer::ROL_UID, '', Criteria::NOT_EQUAL);
     $oCriteria2->add(SystemsPeer::SYS_CODE, $systemCode);
     $oCriteria2->add(RolesPeer::ROL_CREATE_DATE, '', Criteria::NOT_EQUAL);
     $oCriteria2->add(RolesPeer::ROL_UPDATE_DATE, '', Criteria::NOT_EQUAL);
     $oCriteria2->addJoin(RolesPeer::ROL_SYSTEM, SystemsPeer::SYS_UID);
     if ($filter != '') {
         $oCriteria2->add(RolesPeer::ROL_CODE, '%' . $filter . '%', Criteria::LIKE);
     }
     $result['COUNTER'] = $oCriteria2;
     $oCriteria = new Criteria('rbac');
     $oCriteria->clear();
     $oCriteria->addSelectColumn(RolesPeer::ROL_UID);
     $oCriteria->addSelectColumn(RolesPeer::ROL_PARENT);
     $oCriteria->addSelectColumn(RolesPeer::ROL_SYSTEM);
     $oCriteria->addSelectColumn(SystemsPeer::SYS_CODE);
     $oCriteria->addSelectColumn(RolesPeer::ROL_CODE);
     $oCriteria->addSelectColumn(RolesPeer::ROL_CREATE_DATE);
     $oCriteria->addSelectColumn(RolesPeer::ROL_UPDATE_DATE);
     $oCriteria->addSelectColumn(RolesPeer::ROL_STATUS);
     $oCriteria->add(RolesPeer::ROL_UID, '', Criteria::NOT_EQUAL);
     $oCriteria->add(SystemsPeer::SYS_CODE, $systemCode);
     $oCriteria->add(RolesPeer::ROL_CREATE_DATE, '', Criteria::NOT_EQUAL);
     $oCriteria->add(RolesPeer::ROL_UPDATE_DATE, '', Criteria::NOT_EQUAL);
     $oCriteria->addJoin(RolesPeer::ROL_SYSTEM, SystemsPeer::SYS_UID);
     if ($filter != '') {
         $oCriteria->add(RolesPeer::ROL_CODE, '%' . $filter . '%', Criteria::LIKE);
     }
     $oCriteria->setOffset($start);
     $oCriteria->setLimit($limit);
     $result['LIST'] = $oCriteria;
     return $result;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:39,代码来源:Roles.php

示例4: clear

 /**
  * Clear the conditions to allow the reuse of the query object.
  * The ModelCriteria's Model and alias 'all the properties set by construct) will remain.
  *
  * @return ModelCriteria The primary criteria object
  */
 public function clear()
 {
     parent::clear();
     $this->with = array();
     $this->primaryCriteria = null;
     $this->formatter = null;
     $this->select = null;
     $this->modelAlias = $this->originalModelAlias;
     $this->currentAlias = null;
     $this->setDbName($this->originalDbName);
     $this->useAliasInSQL = false;
     $this->isKeepQuery = true;
     $this->previousJoin = null;
     $this->isWithOneToMany = false;
     $this->replacedColumns = array();
     $this->foundMatch = false;
     return $this;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:24,代码来源:ModelCriteria.php


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