1 | <?php |
||
17 | class DealerImage extends BaseDealerImage implements FileModelInterface |
||
18 | { |
||
19 | use CatalogBreadcrumbTrait; |
||
20 | |||
21 | const IMAGE_TYPE_HEADER = "imageHeader"; |
||
22 | const IMAGE_TYPE_BOX = "imageBox"; |
||
23 | |||
24 | /** |
||
25 | * @var array Possible image types |
||
26 | */ |
||
27 | const POSSIBLE_TYPE = array(self::IMAGE_TYPE_HEADER, self::IMAGE_TYPE_BOX); |
||
28 | |||
29 | /** |
||
30 | * Set file parent id |
||
31 | * |
||
32 | * @param int $parentId parent id |
||
33 | * |
||
34 | * @return $this |
||
35 | */ |
||
36 | public function setParentId($parentId) |
||
41 | |||
42 | /** |
||
43 | * Get file parent id |
||
44 | * |
||
45 | * @return int parent id |
||
46 | */ |
||
47 | public function getParentId() |
||
51 | |||
52 | /** |
||
53 | * @return FileModelParentInterface the parent file model |
||
54 | */ |
||
55 | public function getParentFileModel() |
||
59 | |||
60 | public static function getTypeIdFromLabel($type) { |
||
63 | |||
64 | public function getBreadcrumb(Router $router, $container, $tab, $locale) |
||
68 | |||
69 | /** |
||
70 | * @return string the URL to redirect to after update from the back-office |
||
71 | */ |
||
72 | public function getRedirectionUrl() |
||
76 | |||
77 | public function getUploadDir() |
||
87 | |||
88 | /** |
||
89 | * Get the Query instance for this object |
||
90 | * |
||
91 | * @return DealerImageQuery |
||
92 | */ |
||
93 | public function getQueryInstance() |
||
97 | |||
98 | /** |
||
99 | * Set the current locale |
||
100 | * |
||
101 | * @param bool $visible true if the file is visible, false otherwise |
||
102 | * @return FileModelInterface |
||
103 | */ |
||
104 | public function setVisible($visible) |
||
108 | |||
109 | public function preDelete(ConnectionInterface $con = null) |
||
119 | |||
120 | /** |
||
121 | * Get the ID of the form used to change this object information |
||
122 | * @return int type |
||
123 | */ |
||
124 | public function getUpdateFormId() |
||
128 | |||
129 | /** |
||
130 | * get the image type according form id |
||
131 | * |
||
132 | * @param $formId |
||
133 | * @return int type |
||
134 | */ |
||
135 | public static function getTypeFromFormId($formId) |
||
149 | |||
150 | /** |
||
151 | * @param $parentId |
||
152 | * @param $formName |
||
153 | * @return DealerImage |
||
154 | */ |
||
155 | public static function fromProductIdAndFormName($parentId, $formName) |
||
169 | } |
||
170 |
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: