Reputation: 5629
I've got this in my controller:
/**
* shopUsrMasterdataRepository
*
* @var
\TYPO3\BackendcustomerExtension\Domain\Repository\ShopUsrMasterdataRepository
* @inject
*/
protected $shopUsrMasterdataRepository;
$user = $this->shopUsrMasterdataRepository->findAll();
It Returns empty or null ... But in database there are abot 600 entries.
what could be the problem?
Using TYPO3 6.2.31
Thanks
Upvotes: 0
Views: 3459
Reputation: 4271
In almost all cases this is caused by setting an incorrect storagePageUid
in the persistence configuration for Extbase, in the scope that applies to your extension or backend module, whichever you are building.
Other possible causes can be use of record types (see FrontendUser domain model shipped with Extbase). If your domain model extends or uses fe_user
then these considerations also apply to your case. Also, if you've declared enableFields
on the TCA that applies to your table, these will be respected. If your table supports languages then the sys_language_uid
also comes into effect. And finally: if you declared hidden
or delete
field these will also be respected.
If your use case demands that your TCA contains such enableFields
but the plugin/module you build must not respect them, your option is to override createQuery()
on Repository to manipulate the QuerySettings and force respectEnableFields
or others to FALSE.
Edit: solution found, missing type mapping TS:
config.tx_extbase.persistence.classes {
Vendor\ExtKey\Domain\Model\Record.mapping {
recordType = Tx_ExtKey_Domain_Model_Record`
}
}
Upvotes: 3
Reputation: 604
Set a pid (where the records are located) via TypoScript
plugin.tx_myext {
persistence {
storagePid = xxx
}
}
or disable the requirement for a pid in your controller, e.g.:
/** @var \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings $querySettings */
$querySettings = $this->objectManager->get('TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings');
$querySettings->setRespectStoragePage(false);
$this->myRepository->setDefaultQuerySettings($querySettings);
Upvotes: 5