1 | <?php |
||
12 | final class Attribute extends ValueObject |
||
13 | { |
||
14 | /** |
||
15 | * @var \Netgen\InformationCollection\Doctrine\Entity\EzInfoCollectionAttribute |
||
16 | */ |
||
17 | protected $attribute; |
||
18 | |||
19 | /** |
||
20 | * @var \eZ\Publish\API\Repository\Values\Content\Field |
||
21 | */ |
||
22 | protected $field; |
||
23 | |||
24 | /** |
||
25 | * @var \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition |
||
26 | */ |
||
27 | protected $fieldDefinition; |
||
28 | |||
29 | /** |
||
30 | * @var int |
||
31 | */ |
||
32 | protected $id; |
||
33 | |||
34 | /** |
||
35 | * @var \eZ\Publish\API\Repository\Values\Content\Content |
||
36 | */ |
||
37 | protected $content; |
||
38 | |||
39 | /** |
||
40 | * @var \Netgen\InformationCollection\API\Value\AttributeValue |
||
41 | */ |
||
42 | protected $value; |
||
43 | |||
44 | public function __construct( |
||
58 | |||
59 | /** |
||
60 | * @return EzInfoCollectionAttribute |
||
61 | */ |
||
62 | public function getAttribute(): EzInfoCollectionAttribute |
||
66 | |||
67 | /** |
||
68 | * @return Field |
||
69 | */ |
||
70 | public function getField(): Field |
||
74 | |||
75 | /** |
||
76 | * @return FieldDefinition |
||
77 | */ |
||
78 | public function getFieldDefinition(): FieldDefinition |
||
82 | |||
83 | /** |
||
84 | * @return int |
||
85 | */ |
||
86 | public function getId(): int |
||
90 | |||
91 | /** |
||
92 | * @return Content |
||
93 | */ |
||
94 | public function getContent(): Content |
||
98 | |||
99 | /** |
||
100 | * @return AttributeValue |
||
101 | */ |
||
102 | public function getValue(): AttributeValue |
||
106 | } |
||
107 |
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: