TYPO3 CMS  TYPO3_6-2
DatabaseRecord.php
Go to the documentation of this file.
1 <?php
3 
22 
26  protected $table;
27 
31  protected $uid;
32 
36  protected $row;
37 
45  static public function create($table, $uid) {
46  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Domain\\Model\\DatabaseRecord', $table, $uid);
47  }
48 
56  static public function createFromArray($table, array $row) {
57  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Domain\\Model\\DatabaseRecord', $table, $row['uid'], $row);
58  }
59 
65  public function __construct($table, $uid, array $row = NULL) {
66  $this->setTable($table);
67  $this->setUid($uid);
68  if ($row !== NULL) {
69  $this->setRow($row);
70  }
71  }
72 
78  public function getTable() {
79  return $this->table;
80  }
81 
88  public function setTable($table) {
89  $this->table = $table;
90  }
91 
97  public function getUid() {
98  return $this->uid;
99  }
100 
107  public function setUid($uid) {
108  $this->uid = $uid;
109  }
110 
116  public function getRow() {
117  $this->loadRow();
118  return $this->row;
119  }
120 
127  public function setRow(array $row) {
128  $this->row = $row;
129  }
130 
136  public function getIdentifier() {
137  return implode(':', array($this->getTable(), $this->getUid()));
138  }
139 
145  protected function loadRow() {
146  if ($this->row === NULL) {
147  $this->row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->getTable(), $this->getUid());
148  }
149  }
150 
151 }
__construct($table, $uid, array $row=NULL)