[TYPO3-team-core-v5] RFC: fluent interface to query persistence
Karsten Dambekalns
karsten at typo3.org
Tue Jul 22 12:15:08 CEST 2008
Hi.
What do you think about this:
// create a query for Blog instances
$query = $this->queryFactory->create('F3_Blog_Domain_Blog');
// only instances where name equals $name
$blogs = $query->matching('name', '=', $name)->execute();
// create a query for Post instances
$query = $this->queryFactory->create('F3_Blog_Domain_Post');
// title or content must contain FLOW3
$posts = $query
->matching('title', '~', '%FLOW3%')
->orMatching('content', '~', '%FLOW3%')
->execute();
// create a query for Post instances
$query = $this->queryFactory->create('F3_Blog_Domain_Post');
// title must contain FLOW3 or
// (content mentions cool and title ends in TYPO3)
$posts = $query
->matching('title', '~', '%FLOW3%')
->orMatching($query
->matching('content', '~', 'cool')
->andMatching('title', '~', '%TYPO3')
)
->execute();
Intuitive? Easy (enough)? Misses something?
Remember: this is not about SQL, it is about fetching object instances
from the persistence layer in FLOW3.
Regards,
Karsten
More information about the TYPO3-team-core-v5
mailing list