I am building an extension with a backend module. When I call the findAll() method it returns a "QueryResult" object.
I tried to retrieve objects with findByUid() and it does work.
I set the storage pid in the typoscript:
plugin.tx_hwforms.persistence.storagePid = 112
I can also see it in the typoscript object browser.
I also added this to my repository class:
public function initializeObject()
{
$defaultQuerySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
$defaultQuerySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($defaultQuerySettings);
}
so that the storage pid is ignored ... It's still not working, findAll doesn't return an array of entites as it should
I would inspect the generated query itself. Configure the following option in the install tool:
Note: dont do this in production environemnt!!
Explanation for sqlDebug:
Setting it to "0" will avoid any information being print on screen.
Setting it to "1" will show errors only.
Setting it to "2" will print all queries on screen.
So in Production you want to keep it at "0", in development environments you should set it to "1", if you want to know why some result is empty, configure it to "2".
I would guess that some enablefield configuration causes your problem.
If you retrieve an object by findByUid you will have the return because enablefields are ignored. In every other case enablefields are applied and that may cause your empty result.
Use additionally typoscript module configuration, like
Ensure your Typoscript is loaded in root. For BE modules I prefere to use
where you write your module and extbase configuration.
Repository must return a QueryResult from the
findAll
methods. Only methods which return a single object (findOneByXYZ
) will return anything else.All of the following operations will cause a QueryResult to load the actual results it contains. Until you perform one of these, no results are loaded and debugging the QueryResult will yield no information except for the original Query.
$queryResult->toArray();
$queryResult->offsetGet($offset);
and$queryResult[$offset];
$queryResult->offsetExists($offset);
$queryResult->offsetSet($offset, $value);
and$queryResult[$offset] = $value;
(but be aware that doing this yourself with a QueryResult is illogical).$queryResult->offsetUnset($offset);
andunset($queryResult[$offset]);
(again, illogical to use this yourself)$queryResult->current()
,->key()
,->next()
,->prev()
,->rewind()
and->valid()
which can all be called directly or will be called if you begin iterating the QueryResult.Note that
->getFirst()
and->count()
do not cause the original query to fire and will not fill results if they are not already filled. Instead, they will perform an optimised query.Summa summarum: when you get a QueryResult you must trigger it somehow, which normally happens when you begin to render the result set. It is not a prefilled array; it is a dynamically filled Iterator.
Try to debbug like below and check
findAll()
method present for this repositry. I think this is useful for you click hereAfetr added all your changes once you need to
uninsatll/install
extension.This should work.there must be issue with your storage page in FindAll() extbase check for storage but in findByXXX() it ignore storage.