1 | <?php |
||
21 | class Organization extends ServiceLocator |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * @inheritdoc |
||
26 | */ |
||
27 | public function __construct($config = []) |
||
42 | |||
43 | /** |
||
44 | * Configure a query. |
||
45 | * |
||
46 | * @param mixed $criteria |
||
47 | * @return OrganizationQuery |
||
48 | */ |
||
49 | public function getQuery($criteria = null) |
||
53 | |||
54 | /** |
||
55 | * Configure a query. |
||
56 | * |
||
57 | * @param mixed $criteria |
||
58 | * @return OrganizationQuery |
||
59 | */ |
||
60 | public function find($criteria = null) |
||
64 | |||
65 | /** |
||
66 | * @param array $config |
||
67 | * @return \craft\base\Element|OrganizationElement |
||
68 | */ |
||
69 | public function create(array $config = []) |
||
73 | |||
74 | /** |
||
75 | * Sub-Variables that are accessed 'craft.organization.settings' |
||
76 | * |
||
77 | * @return null|object|Settings |
||
78 | */ |
||
79 | public function getSettings() |
||
83 | |||
84 | /** |
||
85 | * Sub-Variables that are accessed 'craft.organization.type' |
||
86 | * |
||
87 | * @return null|object|Type |
||
88 | */ |
||
89 | public function getType() |
||
93 | |||
94 | /** |
||
95 | * Sub-Variables that are accessed 'craft.organization.user' |
||
96 | * |
||
97 | * @return null|object|User |
||
98 | */ |
||
99 | public function getUser() |
||
103 | } |
||
104 |
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: