[TYPO3-mvc] Extbase query objects - bitwise matching

Christian Kuhn lolli at schwarzbu.ch
Thu Nov 11 01:47:19 CET 2010


Hey.

Disclamer:
I'm still in the noob-phase of extbase -> Don't take my question too 
serious ... it might be stupid ;)

Problem:
I configured a TCA checkbox (radio is the same) with values foo, bar and 
foobar. In the database, each value will be mapped to an integer value: 
1,2 or 4 in this case. If I enable foo and foobar for a record, 
resulting db int would be 5 (101 in binary).

If I want to get all records with foobar checkbox checked, I'd like to 
fire a query: "WHERE myfield & 4 = 4", encapsulated in a repository 
method like findByFoobarEnabled() or something: This is cheap on db 
layer if there is an index on myfield column.

As far as I can see, such a bitwise comparison isn't possible with the 
query object. Current solution is to use the query->statement() as fallback.

Questions:
- Is it feasible to hack up patches for extbase to implement bitwise 
matching? If yes: What needs to be done? If no: How can I extend the 
extbase handling at this point and use it in my extension?
- Should this go to FLOW3 first, and implement the extbase db layer 
afterwards? If yes: What needs to be done in FLOW3?
- Is there an option use all of the given extbase query magic and just 
inject a special SQL part at some point? Something like 
$query->matching($query->logicalAnd($constraint,$query->statement('myfield 
& 4 = 4')))?

Regards
Christian



More information about the TYPO3-project-typo3v4mvc mailing list