[TYPO3-english] widget.paginate works not as expected

Mark Boland mark.boland at boland.de
Thu Feb 13 16:25:14 CET 2020


Hi Christian,

you must stay with Extbase and create a custom Extbase Query [1]. It doesn't work with SQL statements, because the Paginate Widget relies on the Query object to create a LIMIT statement all by itself.

Cheers,

Mark

[1] https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/6-Persistence/3-implement-individual-database-queries.html#individual-database-queries


Am 13.02.20, 16:16 schrieb "Christian Tauscher" <typo3-english-bounces at lists.typo3.org im Auftrag von christian.tauscher at media-distillery.de>:

    Hello!
    
    
    In my extention-Template I use
    
    <f:widget.paginate objects="{images}" as="paginatedImages">
     ...
    
    in my controller:
    
    $images = $this->myRepository->getAll();
    ...assign to images....
    
    so the widget renders as Expected, mutliple pages.
    10 Images per Page, page numbers as expected.
    
    
    
    if I change to this:
    
    
    Controller:
    $images = $this->myRepository->findByCategories("1,2,5");
    
    
    public function findByCategories($categories) {
      $query = $this->createQuery();
      $result = $query->statement(
        'SELECT * FROM
           sys_category, sys_category_record_mm, tx_my_domain_model_image
         WHERE sys_category.uid = sys_category_record_mm.uid_local
         AND tx_art_domain_model_image.uid =
             sys_category_record_mm.uid_foreign
         AND tablenames = "tx_my_domain_model_image"
         AND sys_category.uid in ('.$categories.')'
       );
       return $query->execute();
    }
    
    
    
    The records are OK (Only of the selected categories), but the
    widget.paginate fails:
    
    Only ONE page is rendered with all the results. The pages(-Browser) are
    redered right if I assume the default items pP is 10.
    
    Maybe a different Object type is returned:
    I compared the <f:debug>{images.0}</f:debug> of the the two variants:
    The returned array of the images are identical.
    
    
    But somehow/where the countAll() Result is getting lost.
    
    
    Any help in this issue is welcome!
    
    
    Thank you in advance,
    
    
    Christian.
    
    
    _______________________________________________
    TYPO3-english mailing list
    TYPO3-english at lists.typo3.org
    http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
    




More information about the TYPO3-english mailing list