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

Karsten Dambekalns karsten at typo3.org
Tue Jul 22 15:58:31 CEST 2008


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?

Anyway, I'll work on this a bit longer...

Regards,
Karsten


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