1 | <?php |
||
19 | class Generic |
||
20 | { |
||
21 | /** @var string Entity identifier */ |
||
22 | protected static $identifier; |
||
23 | |||
24 | /** @var string Entity navigation identifiers */ |
||
25 | protected static $navigationIDs = array(); |
||
26 | |||
27 | /** @var array Collection of localized additional fields identifiers */ |
||
28 | protected static $localizedFieldIDs = array(); |
||
29 | |||
30 | /** @var array Collection of NOT localized additional fields identifiers */ |
||
31 | protected static $notLocalizedFieldIDs = array(); |
||
32 | |||
33 | /** @var array Collection of entity field filter */ |
||
34 | protected $fieldFilter = array(); |
||
35 | |||
36 | /** |
||
37 | * Add condition to current query. |
||
38 | * |
||
39 | * @param string $fieldName Entity field name |
||
40 | * @param string $fieldValue Value |
||
41 | * @return self Chaining |
||
42 | */ |
||
43 | public function where($fieldName, $fieldValue = null) |
||
53 | |||
54 | /** |
||
55 | * Get collection of entity identifiers filtered by navigation identifiers. |
||
56 | * |
||
57 | * @param array $entityIDs Additional collection of entity identifiers for filtering |
||
58 | * @return array Collection of material identifiers by navigation identifiers |
||
59 | */ |
||
60 | protected function findByNavigationIDs($entityIDs = array()) |
||
64 | |||
65 | /** |
||
66 | * Get collection of entity identifiers filtered by additional field and its value. |
||
67 | * |
||
68 | * @param array $additionalFields Collection of additional field identifiers => values |
||
69 | * @param array $entityIDs Additional collection of entity identifiers for filtering |
||
70 | * @return array Collection of material identifiers by navigation identifiers |
||
71 | */ |
||
72 | protected function findByAdditionalFields($additionalFields, $entityIDs = array()) |
||
87 | |||
88 | protected function findAdditionalFields($entityIDs) |
||
96 | |||
97 | /** |
||
98 | * Perform SamsonCMS query and get entities collection. |
||
99 | * |
||
100 | * @return mixed[] Collection of found entities |
||
101 | */ |
||
102 | public function find() |
||
124 | } |
||
125 |
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: