Discussion:
[TYPO3-english] FrontendUserRepository in custom extension
Siva Prasad
2014-12-24 13:20:40 UTC
Permalink
HI Guys ,

I am developing a custom extension where I need to use the frontend users in a select box. So for that

/**
* frontendUserRepository
*
* @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
* @inject
*/
protected $frontendUserRepository = NULL;

and inside the list action

$forntendusers = $this->frontendUserRepository->findAll(); everything works fine with out any issues . But I am getting an empty result set .

"TYPO3\CMS\Extbase\Persistence\Generic\QueryResultprototypeobject (empty)" . Read lots of posts related this issue , couldn't exactly find out the reason.

Any help would be appreciated !!
Sinisa Mitrovic
2014-12-24 14:11:05 UTC
Permalink
Hello,

Did you set up persistence storage pid (id of sys folder with fe_user
records)?
You need to set that up, so extension know where to look up for records.

Best regards,
Sinisa Mitrovic
Post by Siva Prasad
HI Guys ,
I am developing a custom extension where I need to use the frontend
users in a select box. So for that
/**
* frontendUserRepository
*
*/
protected $frontendUserRepository = NULL;
and inside the list action
$forntendusers = $this->frontendUserRepository->findAll(); everything
works fine with out any issues . But I am getting an empty result set .
"TYPO3\CMS\Extbase\Persistence\Generic\QueryResultprototypeobject
(empty)" . Read lots of posts related this issue , couldn't exactly
find out the reason.
Any help would be appreciated !!
_______________________________________________
TYPO3-english mailing list
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Siva Prasad
2014-12-26 06:26:21 UTC
Permalink
Hello Sinisa,

Tried this plugin.tx_felogin_pi1.persistence.storagePid = 37 but no luck .

BR
Siva
d.ros
2014-12-26 07:48:50 UTC
Permalink
Post by Siva Prasad
Hello Sinisa,
Tried this plugin.tx_felogin_pi1.persistence.storagePid = 37 but no luck .
BR Siva
Perhaps it's an option for you to rely on femanager, which is a complete
extbase fe_users handling suite. It's also quite good documented.

https://git.typo3.org/TYPO3CMS/Extensions/femanager.git
http://docs.typo3.org/typo3cms/extensions/femanager/Installation/Index.html#quick

Cheers

David
Siva Prasad
2014-12-26 08:00:10 UTC
Permalink
Hello David,

Thanks for the help .

But I have manged to fix it by myself . But I am not sure whether this is the right approach or not

$query = $this->objectManager->get("\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository");
$querySettings = $query->createQuery()->getQuerySettings();
$querySettings->setStoragePageIds(array(37));
$query->setDefaultQuerySettings($querySettings);
$query->findAll();

BR
Siva
Sinisa Mitrovic
2014-12-26 08:14:58 UTC
Permalink
Hello,

You should set your plugin name, not felogin :)

So instead of:
plugin.tx_felogin_pi1.persistence.storagePid = 37
You should set:
plugin.tx_your_plugin_name.persistence.storagePid = 37
And change "your_plugin_name" with actual name of your plugin.

You are fetching fe users from your plugin, so your plugin need to know
where they are :)
This line you used in second mail:
$querySettings->setStoragePageIds(array(37));
Will solve your problem, but you hard code it, and it is better approach
to set this in TYPOScript so you can change it later or include other
sys folders with records.

Best regards,
Sinisa Mitrovic
Post by Siva Prasad
Hello Sinisa,
Tried this plugin.tx_felogin_pi1.persistence.storagePid = 37 but no luck .
BR Siva
_______________________________________________
TYPO3-english mailing list
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Sinisa Mitrovic
2014-12-26 08:26:27 UTC
Permalink
Hello Siva again,

I made one mistake, and I do not want to confuse you.
About this persistence storage pid you do not use name of plugin, but
extension. Example of that you can find in (if you used extension
builder it will be generated for you):
extension folder and Configuration/TypoScript/constants and it will look
something like this:

plugin.tx_your extension {
view {
# cat=plugin.tx_productselector/file; type=string; label=Path
to template root (FE)
templateRootPath = EXT:productselector/Resources/Private/Templates/
# cat=plugin.tx_productselector/file; type=string; label=Path
to template partials (FE)
partialRootPath = EXT:productselector/Resources/Private/Partials/
# cat=plugin.tx_productselector/file; type=string; label=Path
to template layouts (FE)
layoutRootPath = EXT:productselector/Resources/Private/Layouts/
}
persistence {
# cat=plugin.tx_productselector//a; type=string; label=Default
storage PID
storagePid =
}
}

And you should copy to TYPOScript ony:

plugin.tx_your extension {
persistence {
# cat=plugin.tx_productselector//a; type=string; label=Default
storage PID
storagePid = 37
}
}

Or shorter:

plugin.tx_your extension.persistence.storagePid = 37


Best regards,
Sinisa Mitrovic
Post by Sinisa Mitrovic
Hello,
You should set your plugin name, not felogin :)
plugin.tx_felogin_pi1.persistence.storagePid = 37
plugin.tx_your_plugin_name.persistence.storagePid = 37
And change "your_plugin_name" with actual name of your plugin.
You are fetching fe users from your plugin, so your plugin need to
know where they are :)
$querySettings->setStoragePageIds(array(37));
Will solve your problem, but you hard code it, and it is better
approach to set this in TYPOScript so you can change it later or
include other sys folders with records.
Best regards,
Sinisa Mitrovic
Post by Siva Prasad
Hello Sinisa,
Tried this plugin.tx_felogin_pi1.persistence.storagePid = 37 but no
luck .
BR Siva
_______________________________________________
TYPO3-english mailing list
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
_______________________________________________
TYPO3-english mailing list
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Loading...