[TYPO3-mvc] Best prcatise: Get objects including hidden/deleted child objects
christian oettinger
christian.oettinger at gmx.de
Wed Sep 12 20:31:09 CEST 2012
Hi all,
I could need some guru advise, hope anybody can spare some time!
SETTING:
In a Backend Module I have to access objects and their childs without
regards to enable fields (of both object AND child) and based on some
filter settings.
Filters are checking properties of the object AND properties of the
(1:1) child. This can AFAIK only be done by using own statements*.
Thanks to my SQL-Guru Astrid this is already solved (see example below),
so I get the correct objects back from my repository.
But although the object list is put together correctly regarding all
childs, even the deleted ones, The object I get back from repository in
the end does NOT INCLUDE the deleted childs, so in Controller/Fluid I do
not have access on them/their properties.
TASK:
I need the complete object list, including hidden/deleted objects (which
works) and their hidden/deleted childs (which does not).
PROBLEMS:
The only approach I see is to run through each object, get the child by
a custom query in cildRepository and set it to the object.
Problem 1): This seems very consuming
Problem 2): The Module is a strict Read-Only and I am afraid of extbase
persisting an object I manually changed (note that the childs may have
childs again, so cloning the parent object will not help).
QUESTIONS:
1) If doing like decribed above, is there a way to prevent extbase from
persisting automatically, so that the original object will surely untouched?
2) Is there a better way / What would be best practise on doing this?
Thanks for any hints (ready to sponsor help of course, just ask, please)!
christian (oe)
--------------
* AFAIK: $query->getQuerySettings()->setRespectEnableFields(FALSE); will
only have effect on the object itself, not on the childs (which is quite
annoying, especially if object/childs are "connnected" by cascade
remove). So you can not include filters on child properties, for all
deleted/hidden childs will be ignored.
--------------
$statement = 'SELECT *
FROM tx_myext_domain_model_participation
WHERE delivery > 0
AND delivery IN
(
SELECT uid
FROM tx_myext_domain_model_delivery
WHERE certificate != ""
AND download_allowed LIKE 1
)
AND crdate >= '.$from.'
AND crdate <= '.$to.'
...';
$query->statement($statement);
More information about the TYPO3-project-typo3v4mvc
mailing list