當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。