[TYPO3-mvc] filter and pagination views of own extension really slow

Nicole Cordes typo3 at cordes.co
Fri Apr 4 21:48:32 CEST 2014


Hello Daniel,

I don't get why you have the if-count as it is the same partial as in the
paginate widget?!

Your problem with the filter object is the casting to an argument array. I'm
not sure but usually objects are referenced by their id. But as you are
using an object which isn't stored in the database and has no identity it
cannot be reference at all.

Why don't you use an array?


Best regards,
Nicole

--
Nicole Cordes
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org

-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org
[mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von
Daniel Hirth
Gesendet: Freitag, 4. April 2014 12:01
An: typo3-project-typo3v4mvc at lists.typo3.org
Betreff: Re: [TYPO3-mvc] filter and pagination views of own extension really
slow

Thanks for the tips, checking the index and declaring more object properties
as lazy sped up the extension already. I still do have some questions
though:

> The pagination wizard itself just sets the limit to the query and as 
> long as you use "normal" queryResultObjects the request is just send 
> once to the database. Maybe you can provide some code to look over to 
> be sure none of you actions already fetches whole objects.

Okay, so in the action, I just call the repository function and deliver the
results to the view. 

public function listAction($filter) {
    // [...]
    $events = $this->eventRepository->findByFilter($filter);
    $this->view->assign('filter', $filter); }

In the view, the event Items are counted before they are paginated, could
this be a problem? 

<f:if condition="{events}">
    <f:then>
        <f:if condition="{settings.itemsPerPage}">
            <f:then>
                <f:if condition="{events->f:count()} >=
{settings.itemsPerPage}">
                    <f:then>
                        <f:widget.paginate objects="{events}"
as="pageevents">
                            <f:for each="{pageevents}" as="event">
                                <f:render partial="Event/EventItem"
arguments="{event:event}" />
                            </f:for>
                        </f:widget.paginate>
                    </f:then>
                    <f:else>
                        <f:for each="{events}" as="event">
                            <f:render partial="Event/EventItem"
arguments="{event:event}" />
                        </f:for>
                    </f:else>
                </f:if>
            </f:then>
        </f:if>
    </f:then>
    <!-- [...] -->
</f:if>

> 1) don use noCache, with noCache in your Request you dont use any 
> caches use a separat action that is uncached, for example results.
> Then you can display lists (cached) or result-views (uncached)

I created a new action "listResults", which is basically a copy of the list
action, and set it to non-cacheable in the localconf. For the templates of
both the list action and the listResults action the same two partials are
called: 

<f:render partial="Event/EventFilter" arguments="{filter:filter}" />
<f:render partial="Event/EventList" arguments="{events:events}" />

The filter form was changed like this: 

<f:form object="{filter}" name="filter" method="post" action="listResults">
    <!-- [...] -->
</f:form>

So when a visitor uses the filter form he will be redirected to the
listResults action, which is not cached. This works, EXCEPT that the filter
object is lost in the listResults-Action, even though the Post-data is
clearly transferred between the actions. Is this because i chose to use a
filter object instead of an array?

Thanks and best regards
Daniel
_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list