[TYPO3-mvc] $query->contains: Is there something like $query->containsNone('fieldName')?
Martin Kutschker
masi-no at spam-typo3.org
Mon Mar 15 15:05:54 CET 2010
Jochen Rau schrieb:
>
>>> 2) $query->matching($query->contains('categories', NULL))
>>> Result: empty result set.
>>
>> This could IMHO interpreted as "find all entities that has no
>> "category" assigned.
>
> This would be very confusing (depending on the domain logic): If no
> category is selected in the Frontend, all Products without a category
> will be shown?!
>
> I'd like to take the most restrictive edge-case: ... no Product will be
> shown. And add a check for an incoming NULL if necessary to show all
> Products if no there was no selection.
Or raise an exception as well.
>
>>> 4) $query->matching($query->contains('categories', 'foo'))
>>> with property categories == NULL
>>> Result: empty result set.
>>
>> I don't understand this one.
>
> class Tx_MyExt_Domain_Model_Product extends ... {
>
> /**
> * @var
> Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_Category>
> */
> protected $categories = NULL;
>
> }
>
> $query->matching($query->contains('categories', 'foo'))
>
> The property definitely does not contain 'foo' as a category -> empty
> result set.
Hm. Looks a bit strange as it has to me the air of an uncomplete initialization.
>> f) $query->without('categories')
>
> This is ambiguous. "Without a categories property set" (categories ===
> NULL) or "Without a category" (count($categories) === 0).
g) $query->withoutAny('categories')
I see no use case for "categories === NULL".
Masi
More information about the TYPO3-project-typo3v4mvc
mailing list