[TYPO3-mvc] query Content Element Extension

Muriel le Pair typo3 at strangefruit.nl
Tue Apr 15 09:56:12 CEST 2014


Hi,

I have created an Content Element Extension that first outputs a form 
and when submitted I would like to output the some text depending on the 
selected fields in the form.

Normally I would simply query the DB for this, but how does it work for 
an Content Element Extension?

This will retrieve all records:
$data = $this->configurationManager->getContentObject()->data;
$items = $this->itemsRepository->findByUid($data['uid']);

When looking at the queries performed by Extbase as described over here: 
http://www.derhansen.de/2013/01/typo3-get-resulting-sql-from-extbase.html Extbase 
performs 2 queries:

SELECT tt_content.*
FROM tt_content
WHERE tt_content.uid = '97'
AND (tt_content.CType='sfexportdoc_pi1')
AND tt_content.deleted=0
AND (tt_content.t3ver_wsid=0 OR tt_content.t3ver_wsid=0)
AND tt_content.pid<>-1 LIMIT 1

SELECT tx_sfexportdoc_domain_model_items.*
FROM tx_sfexportdoc_domain_model_items
WHERE tx_sfexportdoc_domain_model_items.ttcontentuid = '97'
AND tx_sfexportdoc_domain_model_items.deleted=0
AND (tx_sfexportdoc_domain_model_items.t3ver_wsid=0 OR 
tx_sfexportdoc_domain_model_items.t3ver_wsid=0)
AND tx_sfexportdoc_domain_model_items.pid<>-1 ORDER BY 
tx_sfexportdoc_domain_model_items.ttcontentsorting ASC"

But when I try to query the repository, the query if performed on the 
first table (tt_content):
$query = $this->itemsRepository->createQuery();
$query->matching($query->equals('uid', $data['uid']));

So to make a long story short: how can I retrieve the records from table 
tx_sfexportdoc_domain_model_items with uid 1,2,3?

--
kind regards,

Muriel le Pair





More information about the TYPO3-project-typo3v4mvc mailing list