[TYPO3-dev] Repositories inside CommandController action always uses storagePid 1

Kevin Bentlage info at soloict.nl
Fri Feb 20 16:10:27 CET 2015


Dear,

I am searching for hours now, and I can't get the following problem resolved.

I have created a very basic CommandController action, where I need to fetch and create records from a specific storage folder. I tried everything but the records are stored always in PID 1.

Here is my code.

ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'TYPO3\\MyExt\\Command\\TaskCommandController';

MyExt/Classes/Command/TaskCommandController.php:
namespace TYPO3\MyExt\Command;

class TaskCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandController {
	
	/**
	 * Configuration Manager
	 *
	 * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManager
	 * @inject
	 */
	protected $configurationManager;
	
	/**
	 * Log Repository
	 *
	 * @var \TYPO3\MyExt\Domain\Repository\LogRepository
	 * @inject
	 */
	protected $logRepository;
	
	/**
	 * Publish Command
	 *
	 * @return void
	 */
	public function publishCommand() {
						
		$log = new \TYPO3\MyExt\Domain\Model\Log;
		$log->setMessage('Test from CommandController');
		
		$this->logRepository->add($log);
	}
}

When I run this action via scheduler, it creates a "Log" record under PID 1. In my setup I defined the following;

plugin.tx_myext.persistence.storagePid = 5779
module.tx_myext.persistence.storagePid = 5779

I know that the scheduler uses the "module" settings instead of "plugin" so I tried to do the following in my setup, and even in the ROOT template of the website;

module.tx_myext.persistence < plugin.tx_myext.persistence.storagePid

Nothing is working, even when I tried to prepend this code to my publishCommand action (before the repository add function);

$configurationArray = array(
	'persistence' => array(
		'storagePid' => 5779
	)
);
$this->configurationManager->setConfiguration($configurationArray);

$this->appointmentRepository = $this->objectManager->get('TYPO3\\MyExt\\Domain\\Repository\\LogRepository');

It still stores the records under PID 1.

Before every try I flushed all system caches (Orange Shock Icon) but it does'nt work.

What am I doing wrong here? Thanks in advance!



More information about the TYPO3-dev mailing list