[TYPO3-mvc] $query-Object style question
Stefan Frömken
firma at sfroemken.de
Wed Aug 31 08:16:34 CEST 2011
Am 30.08.2011 19:08, schrieb Zalán Somogyváry:
> 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
Thank you...this works.
I thought there was a possibility like self->, $this-> or whatever to
save the additional line (createQuery). I'm sure I have seen something
like this in past, but maybe I'm wrong.
Stefan
More information about the TYPO3-project-typo3v4mvc
mailing list