[TYPO3-mvc] apply sorting to a Tx_Extbase_Persistence_ObjectStorage in a model's getter method

Thomas Mammitzsch thomas at visualworx.de
Thu Feb 17 16:00:57 CET 2011


Hi Franz,

what about inline records? There is no foreign_table_where and 
foreign_default_sortby seems to get ignored by extbase, although it 
works nice in the backend.

regards, Thomas

Am 27.09.2010 15:48, schrieb Franz Koch:
>>
>> $this->tradefairs is randomly sorted and I want to apply the sorting
>> and the start/end-constraint as it is in my repository.
>> How should I do this best?
>
> For the sorting, simply define a 'foreign_table_where' in the TCA and
> add your default sorting - extbase is respecting that.
>
>
> For the constraints - well, that now depends on your domain. Personally
> I'd keep the 'getTradefairs' method as is for the case you need to
> display all at some place and add a additional getter
> 'getActiveTradefairs' and return the result of
> $tradefairRepository->findActiveByPerson($this,array('start' => 'ASC')
> /* sorting parameter*/);
>  From a DDD point of view it's totally ok to ask a person for it's
> active tradefairs I think.
>
> If you don't want to add a custom method to your model, you could also
> create a custom viewHelper that's filtering the active tradefairs - with
> the downside that it'll create much more overhead as it'll fetch and
> parse all assigned tradefairs.
>
> hth.



More information about the TYPO3-project-typo3v4mvc mailing list