[TYPO3-mvc] How can I "add" some constraints to an existing query

Michael Knoll mimi at kaktusteam.de
Sun Mar 6 13:15:03 CET 2011


Hi there,

I would like to add some constraints to an existing query. As I have 
enableFields turned off for the query, I would like to add deleted='0' 
to disable deleted records. What I did is the following:

if ($respectEnableFields == '0') {
    // We turn off enable fields (hidden and deleted)
    $extbaseQuery->getQuerySettings()->setRespectEnableFields(FALSE);
    if ($respectHiddenField == '1') {
       // Turn on usage of hidden fields --> show records with hidden = 0
       $extbaseQuery->matching($extbaseQuery->logicalAnd(
       $extbaseQuery->equals('hidden', 0)));
			}
    if ($respectDeletedField == '1') {
       // Turn on usage of deleted field --> show records with deleted = 0
       $extbaseQuery->matching($extbaseQuery->logicalAnd(
       $extbaseQuery->equals('deleted', 0)));
    }
}


But this does not preserve any constraints existing in my query... How 
can I achieve "adding" the deleted- or hidden-constraint to an existing 
query?


Thanks a lot!

Greetings

Mimi


More information about the TYPO3-project-typo3v4mvc mailing list