[TYPO3-mvc] How to design/structure complex find operations?

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Tue Jan 25 00:04:51 CET 2011


Nikolas Hagelstein wrote:
> Repository::findByFindConfiguration creates query, constraints,
> orderings and limits from findConfiguration, executes the query and
> returns the result

Hello Nikolas!

What about the wording 'criteria/criterion', like:

	Repository::findByCriteria($criteria);

using:

$criteria = new Tx_Extbase_Persistence_QueryCriteria;
// or Tx_Extbase_Persistence_RepositoryCriteria??

$criteria->setCriteria(array $criteria);
$criteria
->addCriterion(Tx_Extbase_Persistence_Criterion_SortCriterion 
$sortCriterion)
->addCriterion(Tx_Extbase_Persistence_Criterion_FilterCriterion 
$filterCriterion)
->addCriterion(Tx_Extbase_Persistence_Criterion_FilterCriterion 
$filterCriterion);

That's just a rough idea - maybe the generation of $criteria could be 
done by a factory class. But what I'm not sure about, is the actual API 
of the QueryCriteria class, because for me it feels like this is only a 
por wrapper for the Query class - which already has such methods. 
(setOrderings, addConstaints, etc.).

Maybe you can come up with a better idea, but maybe you can use the 
naming or something.

Regards,
Thomas


More information about the TYPO3-project-typo3v4mvc mailing list