[TYPO3-mvc] $query-Object style question

Zalán Somogyváry zalan at gmx.net
Tue Aug 30 19:08:48 CEST 2011


Hello Stefan,

Am 30.08.2011 um 18:56 schrieb Stefan Frömken:

> Hello MVC-Team,
> 
> is there a possibility to get this to work?
> 
> return $this->createQuery()
> 	->matching($query->equals('pid', $type))
> 	->setLimit($amount)
> 	->setOrderings(array(
> 		'datetime' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING,
> 	))
> 	->execute()
> 	->toArray();
> 
> The problem is $query->equals. But how to write it correctly.

You haven't defined $query. Instead write:

$query = $this->createQuery();
$query->matching($query->equals('pid',$type))
	     ->setLimit($amount)
	     ->setOrderings(...)
	     ->execute()
	     ->toArray();

This should work.

Best regards,
Zalán


More information about the TYPO3-project-typo3v4mvc mailing list