/**
  * Applies the API query on the model query through this strategy
  * @param \ride\library\http\jsonapi\JsonApiQuery $jsonApiQuery
  * @param \ride\library\orm\query\ModelQuery $modelQuery
  * @return null
  */
 public function applyFilter(JsonApiQuery $jsonApiQuery, ModelQuery $modelQuery)
 {
     $expression = $jsonApiQuery->getFilter('expression', null);
     if ($expression) {
         $modelQuery->addCondition($expression);
     }
 }
 /**
  * Applies the filter to the provided query
  * @param \ride\library\orm\model\Model $model
  * @param \ride\library\orm\query\ModelQuery $query
  * @param string $fieldName Name of the filter field
  * @param string|array $value Submitted value
  * @return string|array Value of the filter
  */
 public function applyQuery(Model $model, ModelQuery $query, $fieldName, $value = null)
 {
     if ($value === null || $value === '' || is_array($value) && !$value) {
         return null;
     }
     $from = null;
     $until = null;
     $this->getPeriodFromValue($value, $from, $until);
     if ($from) {
         $query->addCondition('{' . $fieldName . '} >= %1%', $from);
     }
     if ($until) {
         $query->addCondition('{' . $fieldName . '} <= %1%', $until);
     }
     return $value;
 }
 /**
  * Applies the filter to the provided query
  * @param \ride\library\orm\model\Model $model
  * @param \ride\library\orm\query\ModelQuery $query
  * @param string $fieldName Name of the filter field
  * @param string|array $value Submitted value
  * @return string|array Value of the filter
  */
 public function applyQuery(Model $model, ModelQuery $query, $fieldName, $value = null)
 {
     if (!$value) {
         return null;
     }
     $query->addCondition('{' . $fieldName . '} = %1%', $value);
     return $value;
 }
 /**
  * Applies the filter to the provided query
  * @param \ride\library\orm\model\Model $model
  * @param \ride\library\orm\query\ModelQuery $query
  * @param string $fieldName Name of the filter field
  * @param string|array $value Submitted value
  * @return string|array Value of the filter
  */
 public function applyQuery(Model $model, ModelQuery $query, $fieldName, $value = null)
 {
     if ($value === null || $value === '' || is_array($value) && !$value) {
         return null;
     }
     $from = null;
     $until = null;
     $this->getPeriodFromValue($value, $from, $until);
     if ($from && $until) {
         $query->addCondition('({dateStop} IS NULL AND %1% <= {dateStart} AND {dateStart} <= %2%) OR ({dateStop} IS NOT NULL AND ((%1% <= {dateStart} AND {dateStart} <= %2%) OR (%1% <= {dateStop} AND {dateStop} <= %2%) OR ({dateStart} <= %1% AND %2% <= {dateStop})))', $from, $until);
     }
     return $value;
 }