0

I'm newbie with TYPO3. I'm facing with this issue, can not get data from database.

I have a plugin with this configure

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Locations.' . $_EXTKEY,
'Locationsfe',
array(
    'Location' => 'list, show, showprice, listprice, listcategory, scan,sharedoffice',
    'Category' => 'list, show',
    'Pricing' => 'list, show, showprice, listprice, scan, test',
    'Template' => 'list, show',
),
// non-cacheable actions
array(
    'Location' => '',
    'Category' => '',
    'Pricing' => 'test',
    'Template' => '',
)

);

And in my controller I have this function

public function testAction() {
    // Get current language
    $currentLanguage = $GLOBALS['TSFE']->sys_language_uid;
    $pricing = $this->pricingRepository->findAll();
    print_r($pricing);
    die('Passed');
}

I also added this line to Constants

plugin.tx_locations.persistence.storagePid = 164

I also created a typo Script

plugin.tx_locations {
view {
    templateRootPath = {$plugin.tx_locations.view.templateRootPath}
    partialRootPath = {$plugin.tx_locations.view.partialRootPath}
    layoutRootPath = {$plugin.tx_locations.view.layoutRootPath}
}
persistence {
    storagePid = 164
}
features {
    # uncomment the following line to enable the new Property Mapper.
    # rewrittenPropertyMapper = 1
}

}

But all of above does not work. Just white page return.

I also read this extbase repository findAll() returns result null

So, what happen? I don't know why. Can you help me to figure it out please.

Thanks in advance.

Daniel
  • 6,916
  • 2
  • 36
  • 47
Diego
  • 31
  • 3
  • Is there a error in log? – Heinz Schilling Jul 13 '17 at 15:41
  • Hi @HeinzSchilling : There is not any log in typo3 log. Here is the error log in apache [Thu Jul 13 23:45:30.297309 2017] [:error] [pid 6911] [client 127.0.0.1:46974] PHP 18. print_r() /home/quangbv/www/website/typo3conf/ext/locations/Classes/Controller/PricingController.php:194, referer: http://website.mrq/products/clevvermail.html If seem that, the $pricing variable return null or invalid. – Diego Jul 13 '17 at 16:51

1 Answers1

0

Ok i suppose you have created some records from model type pricing in your backend right ;). Then please try this in your controller:

$this->pricingRepository->setDefaultQuerySettings($this->pricingRepository->createQuery()->getQuerySettings()->setRespectStoragePage(false)); /* here we ignore the storage pid to be sure that we look in the entire system, if this works we have some hints that somthing with the storage pid is wrong */
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->pricingRepository); /*please use this for debugging is much easier with this :D*/
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->pricingRepository->findAll());

can you post the debugs please. sorry i can't comment i don't have the right reputation :(

Xippo
  • 54
  • 3
  • Thanks. It's done for now. I try print_r or var_dump, the result is empty. But when I used foreach then print each item. It's okay. – Diego Jul 17 '17 at 04:39