Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple calls to same repository, after first don't get results
    primarykey
    data
    text
    <p>I'm currently writing my own extension based on extbase 1.4.6 on typo3 4.6.18. I have a single plugin that is configured with a flexform utilizing switchableControllerActions to determine which action to execute. Both actions do basically the same but call a different set of data (of the same type) from the db. This is a simplified version of my controlloer:</p> <pre class="lang-php prettyprint-override"><code>class Tx_MyExtension_Controller_MyCurrentController extends Tx_Extbase_MVC_Controller_ActionController { private $this-&gt;extKey = 'my_extension'; protected $myRepository; public function initializeAction() { $this-&gt;myRepository = t3lib_div::makeInstance('Tx_MyExtension_Domain_Repository_MyObjectRepository'); } public function listFutureAction() { t3lib_div::devLog('[listFutureAction] loading objects from DB', $this-&gt;extKey); $myObjects = $this-&gt;myRepository-&gt;findFuture(); if ($myObjects-&gt;count() &gt; 0) { // do something } else { t3lib_div::devLog("[listFutureAction] no result from repository data!", $this-&gt;extKey); } $this-&gt;view-&gt;assign(/* not important */); } public function listPastAction() { t3lib_div::devLog('[listPastAction] loading objects from DB', $this-&gt;extKey); $myObjects = $this-&gt;myRepository-&gt;findPast(); if ($myObjects-&gt;count() &gt; 0) { // do something } else { t3lib_div::devLog("[listPastAction] no result from repository data!", $this-&gt;extKey); } $this-&gt;view-&gt;assign(/* not important */); } } </code></pre> <p>I get the data by implementing the following repository:</p> <pre class="lang-php prettyprint-override"><code>class Tx_MyExtension_Domain_Repository_MyObjectRepository extends Tx_Extbase_Persistence_Repository { /** * Finds all of my objects that are supposed happen in the future. * @return Tx_Extbase_Persistence_QueryResultInterface */ public function findFuture() { $query = $this-&gt;createQuery(); $query-&gt;matching($query-&gt;greaterThanOrEqual('dateTime', new DateTime())); return $query-&gt;execute(); } /** * Gets all of my objects in the past that are intended to be shown. * @return Tx_Extbase_Persistence_QueryResultInterface */ public function findPast() { $query = $this-&gt;createQuery(); $query-&gt;matching( $query-&gt;logicalAnd( $query-&gt;lessThan('dateTime', new DateTime()), $query-&gt;equals('visibleWhenPast', true) ) ); return $query-&gt;execute(); } } </code></pre> <p>Up until here it works, as long I have only one plugin on the page. I can switch the actions and get the different results I expect. When I put the same plugin 2 times on the page the plugin I put on the page first will work fine, but the second one won't get any results. Looking at the dev log I always get "no result from repository data!" from the second plugin call.</p> <p>Can anyone explain why this is happening?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload