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


PHP ProxyQueryInterface::field方法代码示例

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


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

示例1: filter

 /**
  * @param ProxyQueryInterface $queryBuilder
  * @param string              $alias
  * @param string              $field
  * @param mixed               $data
  *
  * @return
  */
 public function filter(ProxyQueryInterface $queryBuilder, $alias, $field, $data)
 {
     if (!$data || !is_array($data) || !array_key_exists('type', $data) || !array_key_exists('value', $data)) {
         return;
     }
     if (is_array($data['value'])) {
         $values = array();
         foreach ($data['value'] as $v) {
             if (!in_array($v, array(BooleanType::TYPE_NO, BooleanType::TYPE_YES))) {
                 continue;
             }
             $values[] = $v == BooleanType::TYPE_YES ? true : false;
         }
         if (count($values) == 0) {
             return;
         }
         $queryBuilder->field($field)->in($values);
         $this->active = true;
     } else {
         if (!in_array($data['value'], array(BooleanType::TYPE_NO, BooleanType::TYPE_YES))) {
             return;
         }
         $value = BooleanType::TYPE_YES == $data['value'] ? true : false;
         $queryBuilder->field($field)->equals($value);
         $this->active = true;
     }
 }
开发者ID:zajca,项目名称:SonataDoctrineMongoDBAdminBundle,代码行数:35,代码来源:BooleanFilter.php

示例2: filter

 /**
  * @param ProxyQueryInterface $queryBuilder
  * @param string              $alias
  * @param string              $field
  * @param mixed               $data
  * @return
  */
 public function filter(ProxyQueryInterface $queryBuilder, $alias, $field, $data)
 {
     if (!$data || !is_array($data) || !array_key_exists('type', $data) || !array_key_exists('value', $data)) {
         return;
     }
     if (is_array($data['value'])) {
         if (count($data['value']) == 0) {
             return;
         }
         if (in_array('all', $data['value'])) {
             return;
         }
         if ($data['type'] == ChoiceType::TYPE_NOT_CONTAINS) {
             $queryBuilder->field($field)->notIn($data['value']);
         } else {
             $queryBuilder->field($field)->in($data['value']);
         }
         $this->active = true;
     } else {
         if ($data['value'] === '' || $data['value'] === null || $data['value'] === false || $data['value'] === 'all') {
             return;
         }
         if ($data['type'] == ChoiceType::TYPE_NOT_CONTAINS) {
             $queryBuilder->field($field)->notEqual($data['value']);
         } else {
             $queryBuilder->field($field)->equals($data['value']);
         }
         $this->active = true;
     }
 }
开发者ID:chovan-zoltan,项目名称:SonataDoctrineMongoDBAdminBundle,代码行数:37,代码来源:ChoiceFilter.php

示例3: handleScalar

 /**
  *
  * @param  ProxyQueryInterface $queryBuilder
  * @param  type                $alias
  * @param  type                $field
  * @param  type                $data
  * @return type
  */
 protected function handleScalar(ProxyQueryInterface $queryBuilder, $alias, $field, $data)
 {
     if (empty($data['value'])) {
         return;
     }
     $id = self::fixIdentifier($data['value']->getId());
     if (isset($data['type']) && $data['type'] == EqualType::TYPE_IS_NOT_EQUAL) {
         $queryBuilder->field($field)->notEqual($id);
     } else {
         $queryBuilder->field($field)->equals($id);
     }
     $this->active = true;
 }
开发者ID:jdshao,项目名称:symfony_backstage,代码行数:21,代码来源:ModelFilter.php

示例4: applyTypeIsEqual

 /**
  * Because we lack a second variable we select a range covering the entire minute.
  *
  * @param \Sonata\AdminBundle\Datagrid\ProxyQueryInterface $queryBuilder
  * @param string                                           $field
  * @param array                                            $data
  */
 protected function applyTypeIsEqual(ProxyQueryInterface $queryBuilder, $field, $data)
 {
     /** @var \DateTime $end */
     $end = clone $data['value'];
     $end->add(new \DateInterval('PT1M'));
     $queryBuilder->field($field)->range($data['value'], $end);
 }
开发者ID:kamillo1888,项目名称:SonataDoctrineMongoDBAdminBundle,代码行数:14,代码来源:DateTimeFilter.php

示例5: filter

 /**
  * @param ProxyQueryInterface $queryBuilder
  * @param string              $alias
  * @param string              $field
  * @param string              $data
  * @return
  */
 public function filter(ProxyQueryInterface $queryBuilder, $name, $field, $data)
 {
     if (!$data || !is_array($data) || !array_key_exists('value', $data)) {
         return;
     }
     $data['value'] = trim($data['value']);
     if (strlen($data['value']) == 0) {
         return;
     }
     $data['type'] = isset($data['type']) && !empty($data['type']) ? $data['type'] : ChoiceType::TYPE_CONTAINS;
     if ($data['type'] == ChoiceType::TYPE_EQUAL) {
         $queryBuilder->field($field)->equals($data['value']);
     } elseif ($data['type'] == ChoiceType::TYPE_CONTAINS) {
         $queryBuilder->field($field)->equals(new \MongoRegex(sprintf('/%s/i', $data['value'])));
     } elseif ($data['type'] == ChoiceType::TYPE_NOT_CONTAINS) {
         $queryBuilder->field($field)->not(new \MongoRegex(sprintf('/%s/i', $data['value'])));
     }
     $this->active = true;
 }
开发者ID:chovan-zoltan,项目名称:SonataDoctrineMongoDBAdminBundle,代码行数:26,代码来源:StringFilter.php

示例6: filter

 /**
  * @param ProxyQueryInterface $queryBuilder
  * @param string              $alias
  * @param string              $field
  * @param string              $data
  * @return
  */
 public function filter(ProxyQueryInterface $queryBuilder, $alias, $field, $data)
 {
     if (!$data || !is_array($data) || !array_key_exists('value', $data) || !is_numeric($data['value'])) {
         return;
     }
     $type = isset($data['type']) ? $data['type'] : false;
     $operator = $this->getOperator($type);
     if (!$operator) {
         $operator = 'equals';
     }
     $queryBuilder->field($field)->{$operator}((double) $data['value']);
     $this->active = true;
 }
开发者ID:chovan-zoltan,项目名称:SonataDoctrineMongoDBAdminBundle,代码行数:20,代码来源:NumberFilter.php

示例7: applyType

 /**
  * @param \Sonata\AdminBundle\Datagrid\ProxyQueryInterface $queryBuilder
  * @param string                                           $operation
  * @param string                                           $field
  * @param \DateTime                                        $datetime
  */
 protected function applyType(ProxyQueryInterface $queryBuilder, $operation, $field, \DateTime $datetime = null)
 {
     $queryBuilder->field($field)->{$operation}($datetime);
     $this->active = true;
 }
开发者ID:chovan-zoltan,项目名称:SonataDoctrineMongoDBAdminBundle,代码行数:11,代码来源:AbstractDateFilter.php


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