src/App/Model/Query/ConditionQuery/Type/DateType.php

Open in your IDE?
  1. <?php
  2. namespace App\Model\Query\ConditionQuery\Type;
  3. use App\Model\Query\ConditionQuery\AbstractType;
  4. use App\Model\Query\ConditionQuery\Condition\EqualCondition;
  5. use App\Model\Query\ConditionQuery\Condition\NotEqualCondition;
  6. class DateType extends AbstractType
  7. {
  8.     const NAME 'date';
  9.     const SPECIAL_VALUES = [
  10.         self::SPECIAL_VALUE_TODAY,
  11.     ];
  12.     const SPECIAL_VALUE_TODAY 'today';
  13.     /**
  14.      * {@inheritDoc}
  15.      */
  16.     public function validate($value): void
  17.     {
  18.         // TODO
  19.     }
  20.     /**
  21.      * @return string[]
  22.      */
  23.     public function getValidOperators(): array
  24.     {
  25.         if ($this->allowsMultiple()) {
  26.             return self::VALID_ARRAY_OPERATOR_NAMES;
  27.         }
  28.         return [
  29.             EqualCondition::NAME => EqualCondition::HUMAN_READABLE_NAME,
  30.             NotEqualCondition::NAME => NotEqualCondition::HUMAN_READABLE_NAME,
  31.         ];
  32.     }
  33. }