[TYPO3-mvc] domain objects and mysql-aggregation attributes

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Feb 21 19:36:35 CET 2011


Hey Stephan,

> Unfortunatelly each game has ONE score (score is no domain object).
> Therefore it seams unnatural to have a getMaxScore method inside the
> game class.

where is the problem when each game only has one score? What do you need 
MAX for?

SELECT * FROM tx_ajadodpm_domain_model_game WHERE g.user2 = 0 ... ORDER 
BY tx_ajadodpm_domain_model_game.store DESC

This could easily be done using QOM:

Tx_Ext_Repository_GameRepository {

   public function findHighscoreGames() {
     $query = $this->createQuery();
     return $query->matching(
       $query->equals('user2', 0)
     )->setOrderings( array('score' => 
Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING ) )
     ->setLimit(100)
     ->execute();
   }

}


Or did I get anything wrong here?

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list