widget.paginate works not as expected

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

widget.paginate works not as expected

Christian Tauscher-4
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
[hidden email]
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Reply | Threaded
Open this post in threaded view
|

Re: widget.paginate works not as expected

Mark Boland-2
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" <[hidden email] im Auftrag von [hidden email]>:

    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
    [hidden email]
    http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
   


_______________________________________________
TYPO3-english mailing list
[hidden email]
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english