[TYPO3-mvc] Save Model in a Schedulertask
Dennis Ahrens
dennis.ahrens at googlemail.com
Tue Mar 22 13:06:23 CET 2011
Hi Alexander.
On 22.03.2011 11:54, Alexander Walther wrote:
> Hi,
>
> i have following method in my Task, but the InstaceModel is not saved.
>
> public function execute() {
>
> $this->objectManager =
> t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
> $this->instaceRepository =
> $this->objectManager->get('Tx_T3observer_Domain_Repository_InstaceRepository');
>
> foreach($this->instaceRepository->findAllEverwhere() as $instace){
> $observerData = unserialize(t3lib_div::getURL($instace->getObserverUrl()));
> if (is_array($observerData)) {
> $instace->setName('test');
> $this->instaceRepository->update($instace);
> }
> }
> return true;
> }
>
> Can some tell me what ist wrong.
>
> Greetings
> Alex
The persistence is handled by Tx_Extbase_Persistence_Manager - when in
controller context this is called automatically. In your case you have
to call it manually.
$persistenceManager =
$this->objectManager->get('Tx_Extbase_Persistence_Manager');
$persistenceManager->persistAll();
regards
Dennis
More information about the TYPO3-project-typo3v4mvc
mailing list