1 | <?php |
||
27 | class FilesystemStorage extends AbstractStorage |
||
28 | { |
||
29 | public const TYPE_DOCUMENT = FilesystemEntity::TYPE_DOCUMENT; |
||
30 | public const TYPE_BINARY = FilesystemEntity::TYPE_BINARY; |
||
31 | public const TYPE_DIRECTORY = FilesystemEntity::TYPE_DIRECTORY; |
||
32 | public const TYPE_SYMLINK = FilesystemEntity::TYPE_SYMLINK; |
||
33 | |||
34 | /** @var string */ |
||
35 | protected $dataGroup = 'webhemi_filesystem'; |
||
36 | /** @var string */ |
||
37 | protected $idKey = 'id_filesystem'; |
||
38 | /** @var string */ |
||
39 | private $idApplication = 'fk_application'; |
||
40 | /** @var string */ |
||
41 | private $idCategory = 'fk_category'; |
||
42 | /** @var string */ |
||
43 | private $idParent = 'fk_parent_node'; |
||
44 | /** @var string */ |
||
45 | private $idDocument = 'fk_filesystem_document'; |
||
46 | /** @var string */ |
||
47 | private $idFile = 'fk_filesystem_file'; |
||
48 | /** @var string */ |
||
49 | private $idDirectory = 'fk_filesystem_directory'; |
||
50 | /** @var string */ |
||
51 | private $idLink = 'fk_filesystem_link'; |
||
52 | /** @var string */ |
||
53 | private $path = 'path'; |
||
54 | /** @var string */ |
||
55 | private $baseName = 'basename'; |
||
56 | /** @var string */ |
||
57 | private $title = 'title'; |
||
58 | /** @var string */ |
||
59 | private $description = 'description'; |
||
60 | /** @var string */ |
||
61 | private $isHidden = 'is_hidden'; |
||
62 | /** @var string */ |
||
63 | private $isReadOnly = 'is_read_only'; |
||
64 | /** @var string */ |
||
65 | private $isDeleted = 'is_deleted'; |
||
66 | /** @var string */ |
||
67 | private $dateCreated = 'date_created'; |
||
68 | /** @var string */ |
||
69 | private $dateModified = 'date_modified'; |
||
70 | /** @var string */ |
||
71 | private $datePublished = 'date_published'; |
||
72 | |||
73 | /** |
||
74 | * Populates an entity with storage data. |
||
75 | * |
||
76 | * @param EntityInterface $dataEntity |
||
77 | * @param array $data |
||
78 | * @return void |
||
79 | * |
||
80 | * @SuppressWarnings(PHPMD.NPathComplexity) - sorry, this will remain like this. It's a complex object, period. |
||
81 | */ |
||
82 | protected function populateEntity(EntityInterface&$dataEntity, array $data) : void |
||
104 | |||
105 | /** |
||
106 | * Get data from an entity. |
||
107 | * |
||
108 | * @param EntityInterface $dataEntity |
||
109 | * @return array |
||
110 | */ |
||
111 | protected function getEntityData(EntityInterface $dataEntity) : array |
||
139 | |||
140 | /** |
||
141 | * Gets the filesystem entity by the identifier. |
||
142 | * |
||
143 | * @param int $identifier |
||
144 | * @return null|FilesystemEntity |
||
145 | */ |
||
146 | public function getFilesystemById(int $identifier) : ? FilesystemEntity |
||
153 | |||
154 | /** |
||
155 | * Gets the filesystem entity set by application and directory. |
||
156 | * |
||
157 | * @param int $applicationId |
||
158 | * @param int $directoryId |
||
159 | * @return FilesystemEntity[] |
||
160 | */ |
||
161 | public function getFilesystemSetByApplicationAndDirectory(int $applicationId, int $directoryId) : ? array |
||
170 | |||
171 | /** |
||
172 | * Gets the filesystem entity set by application and tag. |
||
173 | * |
||
174 | * @param int $applicationId |
||
175 | * @param int $tagId |
||
176 | * @return FilesystemEntity[] |
||
177 | */ |
||
178 | public function getFilesystemSetByApplicationAndTag(int $applicationId, int $tagId) : ? array |
||
205 | |||
206 | /** |
||
207 | * Gets the filesystem entity by application and path. |
||
208 | * |
||
209 | * @param int $applicationId |
||
210 | * @param string $path |
||
211 | * @param string $baseName |
||
212 | * @return null|FilesystemEntity |
||
213 | */ |
||
214 | public function getFilesystemByApplicationAndPath( |
||
230 | |||
231 | /** |
||
232 | * Gets the published documents |
||
233 | * |
||
234 | * @param int $applicationId |
||
235 | * @param array $additionalExpressions |
||
236 | * @param string|null $order |
||
237 | * @param int|null $limit |
||
238 | * @param int|null $offset |
||
239 | * @param string|null $groupBy |
||
240 | * @param string|null $having |
||
241 | * @return FilesystemEntity[] |
||
242 | */ |
||
243 | public function getPublishedDocuments( |
||
288 | |||
289 | /** |
||
290 | * Gets simple structured meta information for a filesystem record. |
||
291 | * |
||
292 | * @param int $filesystemId |
||
293 | * @return array |
||
294 | */ |
||
295 | public function getPublicationMeta(int $filesystemId) : array |
||
318 | } |
||
319 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: