| @@ 8-26 (lines=19) @@ | ||
| 5 | use AmaTeam\ElasticSearch\Mapping\Type\Parameter\Infrastructure\AbstractParameter; |
|
| 6 | use Symfony\Component\Validator\Constraints\Choice; |
|
| 7 | ||
| 8 | class StrategyParameter extends AbstractParameter |
|
| 9 | { |
|
| 10 | const ID = 'strategy'; |
|
| 11 | const FRIENDLY_ID = self::ID; |
|
| 12 | ||
| 13 | const VALUE_TERM = 'term'; |
|
| 14 | const VALUE_RECURSIVE = 'recursive'; |
|
| 15 | ||
| 16 | public function getId(): string |
|
| 17 | { |
|
| 18 | return self::ID; |
|
| 19 | } |
|
| 20 | ||
| 21 | public function getConstraints(): array |
|
| 22 | { |
|
| 23 | $values = [self::VALUE_TERM, self::VALUE_RECURSIVE]; |
|
| 24 | return [new Choice(['strict' => true, 'choices' => $values])]; |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 8-26 (lines=19) @@ | ||
| 5 | use AmaTeam\ElasticSearch\Mapping\Type\Parameter\Infrastructure\AbstractParameter; |
|
| 6 | use Symfony\Component\Validator\Constraints\Choice; |
|
| 7 | ||
| 8 | class TreeParameter extends AbstractParameter |
|
| 9 | { |
|
| 10 | const ID = 'tree'; |
|
| 11 | const FRIENDLY_ID = self::ID; |
|
| 12 | ||
| 13 | const VALUE_GEOHASH = 'geohash'; |
|
| 14 | const VALUE_QUADTREE = 'quadtree'; |
|
| 15 | ||
| 16 | public function getId(): string |
|
| 17 | { |
|
| 18 | return self::ID; |
|
| 19 | } |
|
| 20 | ||
| 21 | public function getConstraints(): array |
|
| 22 | { |
|
| 23 | $values = [self::VALUE_GEOHASH, self::VALUE_QUADTREE]; |
|
| 24 | return [new Choice(['strict' => true, 'choices' => $values])]; |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||