[TASK] Add API to retrieve the parent folder of a resource
Currently if some code needs the parent directory or folder object of some files or folders it either needs to query the storage object for the identifier of the parent folder and then create the folder object manually or needs to fiddle around with the identifier manually, assuming that all identifiers are a representation of a hierarchical path as it is for the local driver. The latter not only will fail for all storages having non-path identifiers it is more overhead to create the folder objects manually anyhow. This patch adds "getParentFolder" to the ResourceInterface and implements the method in AbstractFile and Folder as well as it replaces the manual resolval in the file list module. Releases: 6.2 Resolves: #54226 Change-Id: I651d62340186dd9ac57277b498f8f98ee160dfd2 Reviewed-on: https://review.typo3.org/26724 Reviewed-by: Alexander Opitz Reviewed-by: Marcin Sągol Reviewed-by: Sebastian Fischer Tested-by: Sebastian Fischer Reviewed-by: Ernesto Baschny Tested-by: Ernesto Baschny
Showing
- typo3/sysext/core/Classes/Resource/AbstractFile.php 8 additions, 0 deletionstypo3/sysext/core/Classes/Resource/AbstractFile.php
- typo3/sysext/core/Classes/Resource/Folder.php 13 additions, 0 deletionstypo3/sysext/core/Classes/Resource/Folder.php
- typo3/sysext/core/Classes/Resource/ResourceInterface.php 7 additions, 2 deletionstypo3/sysext/core/Classes/Resource/ResourceInterface.php
- typo3/sysext/core/Tests/Unit/Resource/AbstractFileTest.php 60 additions, 0 deletionstypo3/sysext/core/Tests/Unit/Resource/AbstractFileTest.php
- typo3/sysext/core/Tests/Unit/Resource/FolderTest.php 21 additions, 5 deletionstypo3/sysext/core/Tests/Unit/Resource/FolderTest.php
- typo3/sysext/filelist/Classes/FileList.php 1 addition, 3 deletionstypo3/sysext/filelist/Classes/FileList.php
Please register or sign in to comment