TYPO3 CMS  TYPO3_7-6
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 
91  public function setTable($table)
92  {
93  $this->table = $table;
94  }
95 
101  public function getUid()
102  {
103  return $this->uid;
104  }
105 
112  public function setUid($uid)
113  {
114  $this->uid = (int)$uid;
115  }
116 
122  public function getRow()
123  {
124  $this->loadRow();
125  return $this->row;
126  }
127 
134  public function setRow(array $row)
135  {
136  $this->row = $row;
137  }
138 
144  public function getIdentifier()
145  {
146  return implode(':', [$this->getTable(), $this->getUid()]);
147  }
148 
154  protected function loadRow()
155  {
156  if ($this->row === null) {
158  }
159  }
160 }
__construct($table, $uid, array $row=null)
static getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)