本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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));
}
示例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));
}
示例13: addRelationshipDetails
static function addRelationshipDetails(Doctrine_Query $q, $detailIds, $alias = 'r')
{
return $q->andWhereIn($alias . '.detail_id', (array) $detailIds);
}