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


PHP Doctrine_Query::andWhereIn方法代码示例

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


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

示例1: addForeignKeyQuery

 protected function addForeignKeyQuery(Doctrine_Query $query, $field, $value)
 {
     $fieldName = $this->getFieldName($field);
     if (is_array($value)) {
         $query->andWhereIn(sprintf('%s.%s', $this->getRootAlias($query, $fieldName), $fieldName), $value);
     } else {
         $query->addWhere(sprintf('%s.%s = ?', $this->getRootAlias($query, $fieldName), $fieldName), $value);
     }
 }
开发者ID:rafaelgou,项目名称:diem,代码行数:9,代码来源:dmFormFilterDoctrine.php

示例2: addClassIdColumnQuery

  protected function addClassIdColumnQuery(Doctrine_Query $query, $field, $value)
  {
    $rootalias = 'l';
    
    $fieldName = $this->getFieldName($field);

    if (is_array($value))
    {
      $query->andWhereIn(sprintf('%s.%s', $rootalias, $fieldName), $value);
    }
    else
    {
      $query->addWhere(sprintf('%s.%s = ?', $rootalias, $fieldName), $value);
    }
  }
开发者ID:romankallweit,项目名称:swingmachine,代码行数:15,代码来源:dsLessonTeacherFormFilter.class.php

示例3: air2_query_in

/**
 * Add a 'whereIn' or 'whereNotIn' to a Doctrine_Query
 *
 * @param Doctrine_Query $q
 * @param string  $wherein
 * @param string  $column
 */
function air2_query_in(Doctrine_Query $q, $wherein, $column)
{
    if (is_string($wherein) && strlen($wherein) && $wherein != '*') {
        $ins = str_split($wherein);
        if ($ins[0] == '!') {
            array_splice($ins, 0, 1);
            if (count($ins) > 0) {
                $q->andWhereNotIn($column, $ins);
            }
        } else {
            if (count($ins) > 0) {
                $q->andWhereIn($column, $ins);
            }
        }
    }
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:23,代码来源:AIR2_Utils.php

示例4: appendQuery

 /**
  * Appends the necessary clauses to an existing query in order to restrict the query.
  *
  * @param Doctrine_Query $query
  *
  * @return void
  */
 protected function appendQuery(Doctrine_Query $query)
 {
     if (!self::isActive()) {
         return;
     }
     $target = $this->getTarget();
     // null means unlimited access
     if ($target === null) {
         return;
     }
     $field = $this->getField();
     // if we are dealing with an array, generate an IN statement
     if (is_array($target)) {
         // just kill the query if target is empty
         if (empty($target)) {
             $query->andWhere('true=false');
             return;
         }
         $query->andWhereIn($field, $target);
         return;
     }
     // otherwise it is a scalar and we generate a normal where AND statement
     $query->andWhere($field . ' = ?', $target);
 }
开发者ID:slaubi,项目名称:sfDoctrineRowLevelAccessBehaviorPlugin,代码行数:31,代码来源:RowLevelAccess.php

示例5: andWhereIn

 public function andWhereIn($expr, $params = array(), $not = false)
 {
     if (isset($params) && count($params) == 0) {
         if (!$not) {
             return $this->andWhere('0 = 1');
         } else {
             return parent::andWhereIn($expr, $params, $not);
         }
     }
     $this->addWhereInCount(count($params));
     if ($not) {
         $this->andWhere($expr . ' NOT IN ?', array($params));
     } else {
         $this->andWhere($expr . ' IN ?', array($params));
     }
     return $this;
 }
开发者ID:niryuu,项目名称:OpenPNE3,代码行数:17,代码来源:opDoctrineQuery.class.php

示例6: addActivityQuery

 public function addActivityQuery(Doctrine_Query $q, $memberId = null, $viewerMemberId = null, $isCheckApp = true)
 {
     if (is_null($memberId)) {
         $memberId = $this->getMyMemberId();
         if (is_null($memberId)) {
             throw new LogicException('The user is not login.');
         }
     }
     if (is_null($viewerMemberId)) {
         $viewerMemberId = $this->getMyMemberId();
     }
     if (is_null($viewerMemberId)) {
         $flag = self::PUBLIC_FLAG_OPEN;
     } else {
         if ($memberId === $viewerMemberId) {
             $flag = self::PUBLIC_FLAG_PRIVATE;
         } else {
             $relation = Doctrine::getTable('MemberRelationship')->retrieveByFromAndTo($viewerMemberId, $memberId);
             if ($relation && $relation->isFriend()) {
                 $flag = self::PUBLIC_FLAG_FRIEND;
             }
             $flag = self::PUBLIC_FLAG_SNS;
         }
     }
     $q->andWhere('member_id = ?', $memberId);
     $flags = $this->getViewablePublicFlags($flag);
     if (1 === count($flags)) {
         $q->andWhere('public_flag = ?', $flags[0]);
     } else {
         $q->andWhereIn('public_flag', $flags);
     }
     $q->andWhere('in_reply_to_activity_id IS NULL');
     if ($isCheckApp) {
         if (sfConfig::get('sf_app') == 'mobile_frontend') {
             $q->andWhere('is_mobile = ?', true);
         } else {
             $q->andWhere('is_pc = ?', true);
         }
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:40,代码来源:ActivityDataTable.class.php

示例7: addPublicFlagQuery

 public function addPublicFlagQuery(Doctrine_Query $q, $flag)
 {
     switch ($flag) {
         case self::PUBLIC_FLAG_OPEN:
             $q->andWhere('is_open = 1');
             break;
         case self::PUBLIC_FLAG_SNS:
             $q->andWhere('public_flag = ?', self::PUBLIC_FLAG_SNS);
             break;
         case self::PUBLIC_FLAG_FRIEND:
             $q->andWhereIn('public_flag', array(self::PUBLIC_FLAG_SNS, self::PUBLIC_FLAG_FRIEND));
             break;
     }
 }
开发者ID:kawahara,项目名称:opDiaryPlugin,代码行数:14,代码来源:PluginDiaryTable.class.php

示例8: addPublicFlagQuery

 public function addPublicFlagQuery(Doctrine_Query $q, $flag)
 {
     if ($flag === self::PUBLIC_FLAG_PRIVATE) {
         return;
     }
     $flags = self::getViewablePublicFlags($flag);
     if (1 === count($flags)) {
         $q->andWhere('public_flag = ?', array_shift($flags));
     } else {
         $q->andWhereIn('public_flag', $flags);
     }
 }
开发者ID:balibali,项目名称:opAlbumPlugin,代码行数:12,代码来源:PluginAlbumTable.class.php

示例9: andWhereIn

 /**
  * Fixes issue where doctrine returns all records if params are an empty array
  */
 public function andWhereIn($expr, $params = array(), $not = false)
 {
     return parent::andWhereIn($expr, $params === array() ? array(0) : $params, $not);
 }
开发者ID:robertsergio,项目名称:Hadori-Demo,代码行数:7,代码来源:Doctrine_Query_Extra.class.php

示例10: addLevelColumnQuery

 public function addLevelColumnQuery(Doctrine_Query $query, $field, $values)
 {
     if ($values != "") {
         $levels = array();
         $pul = Doctrine::getTable('PossibleUpperLevels')->findByLevelRef($values)->toArray();
         foreach ($pul as $key => $val) {
             $levels[] = $val['level_upper_ref'];
         }
         if (count($levels) > 0) {
             $query->andWhereIn('level_ref', $levels);
         }
     }
     return $query;
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:14,代码来源:BaseFormFilterDoctrine.class.php

示例11: addPermissionCheckToQuery

 /**
  * Called by dmActions->buildQuery()
  * Restreins the query to objects user can act on.
  *
  * @param Doctrine_Query $query
  */
 public function addPermissionCheckToQuery($query)
 {
     $cacheKey = sprintf('%s/%s/%s/permissionsIds', $this->user->getUser()->get('id'), $this->module->getUnderscore(), $this->action);
     if (!$this->has($cacheKey)) {
         $result = array();
         $queryResult = dmDb::table('DmUser')->getModelPermissions($this->action, $this->user->getUser());
         if (empty($queryResult)) {
             $result[] = -1;
         } else {
             foreach ($queryResult as $permission) {
                 $result[] = $permission['secure_record'];
             }
         }
         $this->set($cacheKey, $result);
     }
     return $query->andWhereIn($query->getRootAlias() . '.id', $this->get($cacheKey));
 }
开发者ID:theolymp,项目名称:diem,代码行数:23,代码来源:dmModuleActionRecordSecurityStrategy.class.php

示例12: executeStatusesHomeTimeline

 public function executeStatusesHomeTimeline(sfWebRequest $request)
 {
     $memberId = $this->getMemberId();
     $validators = array('since_id' => new sfValidatorInteger(array('required' => false, 'min' => 1)), 'max_id' => new sfValidatorInteger(array('required' => false, 'min' => 1)), 'count' => new sfValidatorInteger(array('required' => false, 'max' => 200, 'min' => 1)), 'page' => new sfValidatorInteger(array('required' => false, 'min' => 1)), 'term_user' => new sfValidatorBoolean(array('required' => false)));
     $default = array('count' => 20, 'page' => 1, 'term_user' => false);
     $params = $this->validate($validators, $default);
     $q = Doctrine::getTable('ActivityData')->createQuery();
     $dql = 'member_id = ?';
     $dqlParams = array($memberId);
     $friendIds = Doctrine::getTable('MemberRelationship')->getFriendMemberIds($memberId);
     $flags = Doctrine::getTable('ActivityData')->getViewablePublicFlags(ActivityDataTable::PUBLIC_FLAG_FRIEND);
     if ($friendIds) {
         $query = new Doctrine_Query();
         $query->andWhereIn('member_id', $friendIds);
         $query->andWhereIn('public_flag', $flags);
         $dql .= ' OR ' . implode(' ', $query->getDqlPart('where'));
         $dqlParams = array_merge($dqlParams, $friendIds, $flags);
     }
     $q->andWhere('(' . $dql . ')', $dqlParams);
     $q->andWhere('in_reply_to_activity_id IS NULL');
     $q->limit($params['count']);
     if ($params['since_id']) {
         $q->andWhere('id > ?', $params['since_id']);
     }
     if ($params['max_id']) {
         $q->andWhere('id <= ?', $params['max_id']);
     }
     if (1 !== $params['page']) {
         $q->offset(($params['page'] - 1) * $params['count']);
     }
     $activities = $q->orderBy('id DESC')->execute();
     $statuses = array();
     foreach ($activities as $activity) {
         $statuses[] = array('status' => opActivityDataConverter::activityToStatus($activity, $params['term_user']));
     }
     return $this->render(array('statuses' => $statuses));
 }
开发者ID:kawahara,项目名称:opSimpleActivityAPIPlugin,代码行数:37,代码来源:actions.class.php

示例13: addRelationshipDetails

 static function addRelationshipDetails(Doctrine_Query $q, $detailIds, $alias = 'r')
 {
     return $q->andWhereIn($alias . '.detail_id', (array) $detailIds);
 }
开发者ID:silky,项目名称:littlesis,代码行数:4,代码来源:LsQuery.class.php


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