[TYPO3-mvc] $query->contains: Is there something like $query->containsNone('fieldName')?

Jochen Rau jochen.rau at typoplanet.de
Mon Mar 15 14:52:46 CET 2010


Hi. Martin.

On 15.03.10 11:50, Martin Kutschker wrote:
> Jochen Rau schrieb:
>>
>> Let's wrap up the different cases (what I expect to be the result).
>> Inside a ProductRepository we specify:
>
> Too much API oriented. Think about what the user wants to do and then find a suitable method name
> for it.

That's what I strive for. ;-)

>> 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.

>> 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.

> f) $query->without('categories')

This is ambiguous. "Without a categories property set" (categories === 
NULL) or "Without a category" (count($categories) === 0).

Regards
Jochen


More information about the TYPO3-project-typo3v4mvc mailing list