[TYPO3-english] extbase/fluid extension as PLUGIN_TYPE_CONTENT_ELEMENT

Andreas Kiessling kiessling at pluspol.info
Fri Jun 21 15:45:33 CEST 2013


Hi Muriel,

>
> The accordionAction you created fetches the records by first getting the
> uid of the content element and use findByUid() to find the records.
> 
> public function accordionAction() {
>    $data = $this->configurationManager->getContentObject()->data;
> $this->view->assign('content',$this->contentRepository->findByUid($data['uid']));
> 
> }
> 
> But the uid of the content element is stored in tt_content_uid. What did
> you modify so that findByUid() searches in tt_content_uid instead of uid?

I don't query the accordion table, but the tt_content table! The
relation to the accordion table is automatically resolved through
extbase and the annotation in the model and the TCA configuration.

The model is mapped to the table in TypoScript:
https://github.com/akiessling/ak_accordion/blob/master/Configuration/TypoScript/setup.txt
AFAIR, the repository named after the model takes this setting to query
the db.

No guarantee, that this is the best approach! You can also pass the
available data to the datamapper and create the model object yourself. I
don't know about the attached records though then, maybe they need to be
lazyloaded in this case. This was also not tested with multiple
languages and workspaces!

You can alternatively use the uid of the content object and query an
accordion repository (which does not exist in the extension!) for the
attached records. But beware of different uids, depending on the current
language/workspace. Then you would do this:
$this->accordionRepository->findByTtContentUid($uid)

HTH,
Andreas


More information about the TYPO3-english mailing list