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

Sebastian KurfŸürst sebastian at typo3.org
Tue Jul 22 13:50:21 CEST 2008


Hey Karsten,

I just thought about creating a DSL (Domain specific language) as in:
http://grails.org/doc/1.0.x/guide/5.%20Object%20Relational%20Mapping%20(GORM).html#5.4.2%20Criteria

I think that would be a really nice way to specify such a query... 
However, IMO that is not easily possible with PHP.

I would really like it the following way:
$query = $this->queryFactory->create('F3_Blog_Domain_Blog');
$blogs = $query->matching(
		eq('name', $name),
		or(
			like('title', '%FLOW3%'),
			like('content', '%FLOW3%')
		)
	 )->execute();

Problem: there would need to be function "eq", and "or", "like", ... 
which sucks.
We could as well parse the whole query tree as a string, but that is 
ugly too...


So what we would ideally need to implement the above would be a magic 
method like __call() on the global scope.


What do you think about it?

Greets,
Sebastian

PS: We can skype, too, if you want to...


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