示例#1
0
 /**
  * @param ParameterBag $parameters
  */
 public function setParameters(ParameterBag $parameters)
 {
     if ($parameters->has(ParameterBag::MINIFIED_PARAMETERS)) {
         $minifiedParameters = $parameters->get(ParameterBag::MINIFIED_PARAMETERS);
         $additional = $parameters->get(ParameterBag::ADDITIONAL_PARAMETERS, []);
         if (array_key_exists(self::MINIFIED_VIEWS_PARAM_KEY, $minifiedParameters)) {
             $additional[self::VIEWS_PARAM_KEY] = $minifiedParameters[self::MINIFIED_VIEWS_PARAM_KEY];
         }
         $parameters->set(ParameterBag::ADDITIONAL_PARAMETERS, $additional);
     }
     parent::setParameters($parameters);
 }
示例#2
0
 /**
  * @param ParameterBag $parameters
  */
 public function setParameters(ParameterBag $parameters)
 {
     if ($parameters->has(ParameterBag::MINIFIED_PARAMETERS)) {
         $minifiedParameters = $parameters->get(ParameterBag::MINIFIED_PARAMETERS);
         $sorters = [];
         if (array_key_exists(self::MINIFIED_SORTERS_PARAM, $minifiedParameters)) {
             $sorters = $minifiedParameters[self::MINIFIED_SORTERS_PARAM];
             if (is_array($sorters)) {
                 foreach ($sorters as $field => $direction) {
                     $sorters[$field] = $direction > 0 ? self::DIRECTION_DESC : self::DIRECTION_ASC;
                 }
             }
         }
         $parameters->set(self::SORTERS_ROOT_PARAM, $sorters);
     }
     parent::setParameters($parameters);
 }
 /**
  * Set columns params data from minified params
  *
  * @param ParameterBag $parameters
  */
 public function setParameters(ParameterBag $parameters)
 {
     if ($parameters->has(ParameterBag::MINIFIED_PARAMETERS)) {
         $minifiedParameters = $parameters->get(ParameterBag::MINIFIED_PARAMETERS);
         $columns = '';
         if (array_key_exists(self::MINIFIED_COLUMNS_PARAM, $minifiedParameters)) {
             $columns = $minifiedParameters[self::MINIFIED_COLUMNS_PARAM];
         }
         $parameters->set(self::MINIFIED_COLUMNS_PARAM, $columns);
     }
     parent::setParameters($parameters);
 }
示例#4
0
 /**
  * @param ParameterBag $parameters
  */
 public function setParameters(ParameterBag $parameters)
 {
     if ($parameters->has(ParameterBag::MINIFIED_PARAMETERS)) {
         $minifiedParameters = $parameters->get(ParameterBag::MINIFIED_PARAMETERS);
         $filters = [];
         if (array_key_exists(self::MINIFIED_FILTER_PARAM, $minifiedParameters)) {
             $filters = $minifiedParameters[self::MINIFIED_FILTER_PARAM];
         }
         $parameters->set(self::FILTER_ROOT_PARAM, $filters);
     }
     parent::setParameters($parameters);
 }
示例#5
0
 /**
  * @param ParameterBag $parameters
  */
 public function setParameters(ParameterBag $parameters)
 {
     if ($parameters->has(ParameterBag::MINIFIED_PARAMETERS)) {
         $minifiedParameters = $parameters->get(ParameterBag::MINIFIED_PARAMETERS);
         $pager = [];
         if (array_key_exists(PagerInterface::MINIFIED_PAGE_PARAM, $minifiedParameters)) {
             $pager[PagerInterface::PAGE_PARAM] = $minifiedParameters[PagerInterface::MINIFIED_PAGE_PARAM];
         }
         if (array_key_exists(PagerInterface::MINIFIED_PER_PAGE_PARAM, $minifiedParameters)) {
             $pager[PagerInterface::PER_PAGE_PARAM] = $minifiedParameters[PagerInterface::MINIFIED_PER_PAGE_PARAM];
         }
         $parameters->set(PagerInterface::PAGER_ROOT_PARAM, $pager);
     }
     parent::setParameters($parameters);
 }
 public function testParameters()
 {
     $parameters = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datagrid\\ParameterBag');
     $this->extension->setParameters($parameters);
     $this->assertEquals($parameters, $this->extension->getParameters($parameters));
 }