I’ve got a problem concerning a plugin I’m writing for Typo3. I want to have access to a repository (and the content of that) of a plugin in a different plugin. Like importing the stuff from one plugin to another. What I tried was using @inject in my controller, but the result is null.
/**
* @var SebklnAjaxselectlistDomainRepositoryOptionRecordRepository
*/
protected $optionRecordRepository = null;
/**
* @param SebklnAjaxselectlistDomainRepositoryOptionRecordRepository
*/
public function injectOptionRecordRepository(SebklnAjaxselectlistDomainRepositoryOptionRecordRepository $optionRecordRepository) {
$this->optionRecordRepository = $optionRecordRepository;
}
And my action function:
$standorts = $this->optionRecordRepository->findAll();
$this->view->assign('standorts', $standorts);
My Typo3 version is 9.5, so may one got an idea what I should do. Thanks in advance.
Advertisement
Answer
You have to set the storagePid where the records are stored.
plugin.tx_[lowercasedextensionname] {
persistence {
storagePid = 12,22
}
}
Or ignore it in repository if records are stored at unknown places.
/**
* Initializes the repository.
*/
public function initializeObject()
{
/** @var TYPO3CMSExtbasePersistenceGenericQuerySettingsInterface $querySettings */
$querySettings = $this->objectManager->get(QuerySettingsInterface::class);
$querySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($querySettings);
}