TYPO3
7.6
Users
bogdan
Projects
Kapeli
Resources
Dash
Docsets
TYPO3
src
typo3
sysext
workspaces
Classes
Domain
Record
AbstractRecord.php
Go to the documentation of this file.
1
<?php
2
namespace
TYPO3\CMS\Workspaces\Domain\Record;
3
17
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
18
use
TYPO3\CMS\Workspaces\Service\StagesService
;
19
23
abstract
class
AbstractRecord
24
{
28
protected
$record
;
29
30
protected
static
function
fetch
($tableName, $uid)
31
{
32
$record
= static::getDatabaseConnection()->exec_SELECTgetSingleRow(
'*'
, $tableName,
'deleted=0 AND uid='
. (
int
)$uid);
33
if
(empty(
$record
)) {
34
throw
new \RuntimeException(
'Record "'
. $tableName .
':'
. $uid .
'" not found'
);
35
}
36
return
$record
;
37
}
38
42
protected
static
function
getDatabaseConnection
()
43
{
44
return
$GLOBALS
[
'TYPO3_DB'
];
45
}
46
50
protected
static
function
getBackendUser
()
51
{
52
return
$GLOBALS
[
'BE_USER'
];
53
}
54
58
protected
static
function
getLanguageService
()
59
{
60
return
$GLOBALS
[
'LANG'
];
61
}
62
66
public
function
__construct
(array
$record
)
67
{
68
$this->record =
$record
;
69
}
70
74
public
function
__toString
()
75
{
76
return
(
string
)$this->
getUid
();
77
}
78
82
public
function
getUid
()
83
{
84
return
(
int
)$this->record[
'uid'
];
85
}
86
90
public
function
getTitle
()
91
{
92
return
(
string
)$this->record[
'title'
];
93
}
94
98
protected
function
getStagesService
()
99
{
100
return
GeneralUtility::makeInstance
(StagesService::class);
101
}
102
}
Generated on Wed Nov 11 2015 01:51:49 for TYPO3 by
1.8.3