[TYPO3-team-core-v5] RFC: fluent interface to query persistence

Christoph Koehler christoph.koehler at gmail.com
Wed Jul 23 05:43:28 CEST 2008


In article
<mailman.1.1216735111.24260.typo3-team-core-v5 at lists.netfielders.de>Kar
sten Dambekalns <karsten at typo3.org> wrote:
>  Sebastian KurfŸürst wrote:
>>   Hey Karsten,
 
>>>>   We would need a precedence here - so what is the difference
>>>>  between:
>>    >
>>>   Probably no useful difference. You need to specify precedence by
>>> correctly nesting yourself (as in my other example).
>>   And what happens if somebody specifies a query like in my example,
>> f.e.  if he did not fully understand how to use it? Is an exception
>> raised? I still see a problem here...

>  Well, if people do the wrong thing, the wrong thing will eventually
> happen. :) What happens if you do this?
>    SELECT * FROM table WHERE field1=1 OR field2=2 AND field3=3

>  I don't know, so I'd (personally) always use parenthesis to make it
> explicit what I want.
>>   You specify "matches .... andMatches ..." and I specified
>> andMatches(..., ...), so it is easier to see the tree:

>  Yes, but in my examples I had this as well:

>       ->matching('title', '~', '%FLOW3%')
>       ->orMatching($query
>         ->matching('content', '~', 'cool')
>         ->andMatching('title', '~', '%TYPO3')
>       )

>  See?


How would you handle nested AND / OR queries? Stuff like (1 AND 2) OR
(3 AND 4) ?

Christoph

-- 
I'm using an evaluation license of nemo since 407 days.
You should really try it!
http://www.malcom-mac.com/nemo



More information about the TYPO3-team-core-v5 mailing list