1 | <?php |
||
20 | class Field extends BaseParser |
||
21 | { |
||
22 | const OPERATORS = [ |
||
23 | 'IN' => Operator::IN, |
||
24 | 'EQ' => Operator::EQ, |
||
25 | 'GT' => Operator::GT, |
||
26 | 'GTE' => Operator::GTE, |
||
27 | 'LT' => Operator::LT, |
||
28 | 'LTE' => Operator::LTE, |
||
29 | 'LIKE' => Operator::LIKE, |
||
30 | 'BETWEEN' => Operator::BETWEEN, |
||
31 | 'CONTAINS' => Operator::CONTAINS, |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * Parses input structure to a Criterion object. |
||
36 | * |
||
37 | * @param array $data |
||
38 | * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher |
||
39 | * |
||
40 | * @throws \eZ\Publish\Core\REST\Common\Exceptions\Parser |
||
41 | * |
||
42 | * @return \eZ\Publish\API\Repository\Values\Content\Query\Criterion\Field |
||
43 | */ |
||
44 | public function parse(array $data, ParsingDispatcher $parsingDispatcher) |
||
63 | |||
64 | /** |
||
65 | * Get operator for the given literal name. |
||
66 | * |
||
67 | * For the full list of supported operators: |
||
68 | * @see \eZ\Publish\Core\REST\Server\Input\Parser\Criterion\Field::OPERATORS |
||
69 | * |
||
70 | * @param string $operatorName operator literal operator name |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | private function getOperator($operatorName) |
||
88 | } |
||
89 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: