TYPO3 CMS  TYPO3_8-7
DatabaseRecord.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
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.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
25  protected $table;
26 
30  protected $uid;
31 
35  protected $row;
36 
44  public static function create($table, $uid)
45  {
46  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord::class, $table, $uid);
47  }
48 
56  public static function createFromArray($table, array $row)
57  {
58  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord::class, $table, $row['uid'], $row);
59  }
60 
66  public function __construct($table, $uid, array $row = null)
67  {
68  $this->setTable($table);
69  $this->setUid($uid);
70  if ($row !== null) {
71  $this->setRow($row);
72  }
73  }
74 
80  public function getTable()
81  {
82  return $this->table;
83  }
84 
90  public function setTable($table)
91  {
92  $this->table = $table;
93  }
94 
100  public function getUid()
101  {
102  return $this->uid;
103  }
104 
110  public function setUid($uid)
111  {
112  $this->uid = (int)$uid;
113  }
114 
120  public function getRow()
121  {
122  $this->loadRow();
123  return $this->row;
124  }
125 
131  public function setRow(array $row)
132  {
133  $this->row = $row;
134  }
135 
141  public function getIdentifier()
142  {
143  return implode(':', [$this->getTable(), $this->getUid()]);
144  }
145 
149  protected function loadRow()
150  {
151  if ($this->row === null) {
153  }
154  }
155 }
__construct($table, $uid, array $row=null)
static getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)