2 namespace TYPO3\CMS\Workspaces\Domain\Record
;
5 * This file is part of the TYPO3 CMS project.
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
16 use TYPO3\CMS\Core\Utility\GeneralUtility
;
17 use TYPO3\CMS\Workspaces\Service\StagesService
;
20 * Combined record class
22 abstract class AbstractRecord
29 protected static function fetch($tableName, $uid)
31 $record = static::getDatabaseConnection()->exec_SELECTgetSingleRow('*', $tableName, 'deleted=0 AND uid=' . (int)$uid);
33 throw new \
RuntimeException('Record "' . $tableName . ':' . $uid . '" not found');
39 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
41 protected static function getDatabaseConnection()
43 return $GLOBALS['TYPO3_DB'];
47 * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
49 protected static function getBackendUser()
51 return $GLOBALS['BE_USER'];
55 * @return \TYPO3\CMS\Lang\LanguageService
57 protected static function getLanguageService()
59 return $GLOBALS['LANG'];
63 * @param array $record
65 public function __construct(array $record)
67 $this->record
= $record;
73 public function __toString()
75 return (string)$this->getUid();
81 public function getUid()
83 return (int)$this->record
['uid'];
89 public function getTitle()
91 return (string)$this->record
['title'];
95 * @return StagesService
97 protected function getStagesService()
99 return GeneralUtility
::makeInstance(StagesService
::class);