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