[TYPO3-mvc] Howto query the repository from another extension in your own extension

Adrien Crivelli adrien.crivelli at gmail.com
Tue Jul 10 08:41:14 CEST 2012


Hi Thomas,

I believe your trouble have the same origin as mine explained in that
thread:
http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2012-June/012478.html

Basically *extbase does not load configuration from "third party" extension*.
Thus will not know of the correct PID. To assert that this is indeed the
case, you can add a var_dump($statement); in function buildQuery() in the
file /typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php.
With that you will be able to see all SQL queries from extbase and you will
probably notice that the PID used in the query is 0 (as defined
in Tx_Extbase_Configuration_AbstractConfigurationManager::DEFAULT_BACKEND_STORAGE_PID).

The obvious, incredibly ugly, workaround is to
duplicated configuration from third-party extension into your own. But in
my opinion it is actually a bug in extbase that need to be fixed. So *please
let me know if I am right*, so we can work on a patch to solve this issue
for everybody.

Good luck,

Adrien


On 9 July 2012 23:09, Thomas Meixner <tom.meixner at gmail.com> wrote:

> Thx for the quick answer.
>
> My little collection of storagePid configurations:
>
> config.tx_extbase.persistence.storagePid = 32, 36, 26
>
> plugin.tx_ainesnews.persistence.storagePid = 32, 36, 26
> plugin.tx_news.persistence.storagePid = 32, 36, 26
> //this probably doesn't even exist
>
> config.tx_extbase.persistence.classes.Tx_News_Domain_Repository_NewsRepository.storagePid
> = 32, 36, 26
>
> I added now in page TS:
> module.tx_ainesnews.
> persistence.storagePid = 32, 36, 26
> module.tx_news.
> persistence.storagePid = 32, 36, 26
>
> as well as adding the pages with records on it in the plugin as 'Record
> Storage Page' s.
>
> If I query the repository in my own extension I do get results which leads
> me to believe I'm not using CLI mode or there is something wrong with the
> storage pid in general.
> It's only when I query the Repository which belongs to the other extension
> that I get the empty query back.
>
> Is there a way of better debugging the query? If I use
>
> Tx_Extbase_Utility_Debugger::var_dump($this->newsRepository,
> 'newsRepository
> news', 100);
>
> I only the first level of the array. And xdebug in netbeans unfortunatly
> doesn't hit the breakpoint in my controller.
>
>
> Thanks,
>
> Thomas
>
> >> Are you using CLI mode? In that case, the persistence storage PID
> >> must be defined in mod.tx_myext…. (free from memory, eact location
> >> might be different).
> >
> > module.tx_myext... ;)
> >
> > Best,
> >
> >
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>


More information about the TYPO3-project-typo3v4mvc mailing list