‪TYPO3CMS  9.5
ModuleDataStorageService.php
Go to the documentation of this file.
1 <?php
3 
6 
7 /*
8  * This file is part of the TYPO3 CMS project.
9  *
10  * It is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License, either version 2
12  * of the License, or any later version.
13  *
14  * For the full copyright and license information, please read the
15  * LICENSE.txt file that was distributed with this source code.
16  *
17  * The TYPO3 project - inspiring people to share!
18  */
19 
26 {
30  const ‪KEY = 'tx_beuser';
31 
35  protected ‪$objectManager;
36 
40  public function ‪injectObjectManager(\‪TYPO3\CMS\‪Extbase\Object\ObjectManagerInterface ‪$objectManager)
41  {
42  $this->objectManager = ‪$objectManager;
43  }
44 
50  public function ‪loadModuleData()
51  {
52  $moduleData = ‪$GLOBALS['BE_USER']->getModuleData(self::KEY) ?? '';
53  if ($moduleData !== '') {
54  $moduleData = @unserialize($moduleData, ['allowed_classes' => [ModuleData::class, Demand::class]]);
55  if ($moduleData instanceof ‪ModuleData) {
56  return $moduleData;
57  }
58  }
59 
60  return $this->objectManager->get(ModuleData::class);
61  }
62 
68  public function ‪persistModuleData(\‪TYPO3\CMS\Beuser\Domain\Model\ModuleData $moduleData)
69  {
70  ‪$GLOBALS['BE_USER']->pushModuleData(self::KEY, serialize($moduleData));
71  }
72 }
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Beuser\Service\ModuleDataStorageService\loadModuleData
‪TYPO3 CMS Beuser Domain Model ModuleData loadModuleData()
Definition: ModuleDataStorageService.php:49
‪TYPO3
‪TYPO3\CMS\Beuser\Service\ModuleDataStorageService\persistModuleData
‪persistModuleData(\TYPO3\CMS\Beuser\Domain\Model\ModuleData $moduleData)
Definition: ModuleDataStorageService.php:67
‪TYPO3\CMS\Beuser\Service\ModuleDataStorageService\injectObjectManager
‪injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
Definition: ModuleDataStorageService.php:39
‪TYPO3\CMS\Beuser\Service\ModuleDataStorageService\$objectManager
‪TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
Definition: ModuleDataStorageService.php:34
‪TYPO3\CMS\Beuser\Service
Definition: ModuleDataStorageService.php:2
‪TYPO3\CMS\Beuser\Domain\Model\Demand
Definition: Demand.php:22
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:22
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Beuser\Service\ModuleDataStorageService\KEY
‪const KEY
Definition: ModuleDataStorageService.php:30
‪TYPO3\CMS\Beuser\Service\ModuleDataStorageService
Definition: ModuleDataStorageService.php:26
‪TYPO3\CMS\Beuser\Domain\Model\ModuleData
Definition: ModuleData.php:22