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:
class Tx_MyExtension_Controller_MyCurrentController extends Tx_Extbase_MVC_Controller_ActionController {
private $this->extKey = 'my_extension';
protected $myRepository;
public function initializeAction() {
$this->myRepository = t3lib_div::makeInstance('Tx_MyExtension_Domain_Repository_MyObjectRepository');
}
public function listFutureAction() {
t3lib_div::devLog('[listFutureAction] loading objects from DB', $this->extKey);
$myObjects = $this->myRepository->findFuture();
if ($myObjects->count() > 0) {
// do something
} else {
t3lib_div::devLog("[listFutureAction] no result from repository data!", $this->extKey);
}
$this->view->assign(/* not important */);
}
public function listPastAction() {
t3lib_div::devLog('[listPastAction] loading objects from DB', $this->extKey);
$myObjects = $this->myRepository->findPast();
if ($myObjects->count() > 0) {
// do something
} else {
t3lib_div::devLog("[listPastAction] no result from repository data!", $this->extKey);
}
$this->view->assign(/* not important */);
}
}
I get the data by implementing the following repository:
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->createQuery();
$query->matching($query->greaterThanOrEqual('dateTime', new DateTime()));
return $query->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->createQuery();
$query->matching(
$query->logicalAnd(
$query->lessThan('dateTime', new DateTime()),
$query->equals('visibleWhenPast', true)
)
);
return $query->execute();
}
}
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.
Can anyone explain why this is happening?