Elgg  Version 4.x
Database.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Application;
4 
6 use Elgg\Database as ElggDb;
7 
15 class Database {
16 
22  private $db;
23 
29  public function __construct(ElggDb $db) {
30  $this->db = $db;
31  }
32 
49  public function getData($query, $callback = '', array $params = []) {
50  return $this->db->getData($query, $callback, $params);
51  }
52 
66  public function getDataRow($query, $callback = '', array $params = []) {
67  return $this->db->getDataRow($query, $callback, $params);
68  }
69 
81  public function insertData($query, array $params = []) {
82  return $this->db->insertData($query, $params);
83  }
84 
96  public function updateData($query, $getNumRows = false, array $params = []) {
97  return $this->db->updateData($query, $getNumRows, $params);
98  }
99 
110  public function deleteData($query, array $params = []) {
111  return $this->db->deleteData($query, $params);
112  }
113 
122  public function getConnection($type) {
123  return $this->db->getConnection($type);
124  }
125 
140  public function registerDelayedQuery($query, $type, $callback = null, array $params = []) {
141  return $this->db->registerDelayedQuery($query, $type, $callback, $params);
142  }
143 
150  public function __get($name) {
151  return $this->db->{$name};
152  }
153 
161  public function __set($name, $value) {
162  $this->db->{$name} = $value;
163  }
164 }
__construct(ElggDb $db)
Constructor.
Definition: Database.php:29
getConnection($type)
Gets (if required, also creates) a DB connection.
Definition: Database.php:122
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
$params
Saves global plugin settings.
Definition: save.php:13
registerDelayedQuery($query, $type, $callback=null, array $params=[])
Queue a query for execution upon shutdown.
Definition: Database.php:140
getDataRow($query, $callback= '', array $params=[])
Retrieve a single row from the database.
Definition: Database.php:66
insertData($query, array $params=[])
Insert a row into the database.
Definition: Database.php:81
$type
Definition: delete.php:21
$value
Definition: generic.php:51
deleteData($query, array $params=[])
Delete data from the database.
Definition: Database.php:110
__set($name, $value)
Handle magic property writes.
Definition: Database.php:161
updateData($query, $getNumRows=false, array $params=[])
Update the database.
Definition: Database.php:96
$query
__get($name)
Handle magic property reads.
Definition: Database.php:150
getData($query, $callback= '', array $params=[])
Retrieve rows from the database.
Definition: Database.php:49