Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getState(Request $request)
 {
     $state = parent::getState($request);
     if ($state->getValue()) {
         $values = explode(';', $state->getValue(), 2);
         $gt = $this->isInclusive() ? 'gte' : 'gt';
         $lt = $this->isInclusive() ? 'lte' : 'lt';
         $normalized[$gt] = $values[0];
         $normalized[$lt] = $values[1];
         $state->setValue($normalized);
     }
     return $state;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getState(Request $request)
 {
     $state = parent::getState($request);
     if (!$state->isActive()) {
         return $state;
     }
     $values = explode(';', $state->getValue(), 2);
     if (count($values) < 2) {
         $state->setActive(false);
         return $state;
     }
     $gt = $this->isInclusive() ? 'gte' : 'gt';
     $lt = $this->isInclusive() ? 'lte' : 'lt';
     $normalized[$gt] = floatval($values[0]);
     $normalized[$lt] = floatval($values[1]);
     $state->setValue($normalized);
     return $state;
 }