[TYPO3-english] Getting sys_file_reference records by uid
Jan Kornblum
jan.kornblum at gmx.de
Mon Mar 3 22:45:24 CET 2014
Hi group, again,
> i use FAL in a plugins flexform configuration to store images. How can i
> fetch the FAL records for the given sys_file_reference uid's from inside a
> controller? I am wondering why there is no FileReferenceRepository to fetch
> the records by their uid...?
this seems to work:
$uid = $this->configurationManager->getContentObject()->data['uid'];
$fileRepository =
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
$fileObjects = $fileRepository->findByRelation('tt_content', 'image',
$uid);
It fetches all FileReference objects for the current content element.
But what i don't understand: These objects are of type
TYPO3\CMS\Core\Resource\FileReference. When i debug any models of an
extension which contains FAL properties, these objects are of type
TYPO3\CMS\Extbase\Domain\Model\FileReference.
So a) what is the difference between both and b) how can i get my
origin approach to return TYPO3\CMS\Extbase\Domain\Model\FileReference
objects instead of TYPO3\CMS\Core\Resource\FileReference objects?
I'm confused ;)
Kind regards, Jan
More information about the TYPO3-english
mailing list