|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Facades for Yii 2 |
|
4
|
|
|
* |
|
5
|
|
|
* Generated on Yii 2.0.12 |
|
6
|
|
|
* |
|
7
|
|
|
* @see https://github.com/sergeymakinen/yii2-facades |
|
8
|
|
|
* @copyright Copyright (c) 2016-2017 Sergey Makinen (https://makinen.ru) |
|
9
|
|
|
* @license https://github.com/sergeymakinen/yii2-facades/blob/master/LICENSE The MIT License |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace sergeymakinen\facades; |
|
13
|
|
|
|
|
14
|
|
|
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ |
|
15
|
|
|
/** |
|
16
|
|
|
* Yii::$app->get('db') facade. |
|
17
|
|
|
* |
|
18
|
|
|
* Methods |
|
19
|
|
|
* |
|
20
|
|
|
* @method static \yii\base\Behavior attachBehavior(string $name, string|array|\yii\base\Behavior $behavior) Attaches a behavior to this component. |
|
21
|
|
|
* @see \yii\base\Component::attachBehavior |
|
22
|
|
|
* |
|
23
|
|
|
* @method static void attachBehaviors(array $behaviors) Attaches a list of behaviors to the component. |
|
24
|
|
|
* @see \yii\base\Component::attachBehaviors |
|
25
|
|
|
* |
|
26
|
|
|
* @method static \yii\db\Transaction beginTransaction(string|null $isolationLevel = null) Starts a transaction. |
|
27
|
|
|
* @see \yii\db\Connection::beginTransaction |
|
28
|
|
|
* |
|
29
|
|
|
* @method static array behaviors() Returns a list of behaviors that this component should behave as. |
|
30
|
|
|
* @see \yii\base\Component::behaviors |
|
31
|
|
|
* |
|
32
|
|
|
* @method static mixed cache(callable $callable, int $duration = null, \yii\caching\Dependency $dependency = null) Uses query cache for the queries performed with the callable. |
|
33
|
|
|
* @see \yii\db\Connection::cache |
|
34
|
|
|
* |
|
35
|
|
|
* @method static void close() Closes the currently active DB connection. |
|
36
|
|
|
* @see \yii\db\Connection::close |
|
37
|
|
|
* |
|
38
|
|
|
* @method static \yii\db\Command createCommand(string $sql = null, array $params = []) Creates a command for execution. |
|
39
|
|
|
* @see \yii\db\Connection::createCommand |
|
40
|
|
|
* |
|
41
|
|
|
* @method static null|\yii\base\Behavior detachBehavior(string $name) Detaches a behavior from the component. |
|
42
|
|
|
* @see \yii\base\Component::detachBehavior |
|
43
|
|
|
* |
|
44
|
|
|
* @method static void detachBehaviors() Detaches all behaviors from the component. |
|
45
|
|
|
* @see \yii\base\Component::detachBehaviors |
|
46
|
|
|
* |
|
47
|
|
|
* @method static void ensureBehaviors() Makes sure that the behaviors declared in [[behaviors()]] are attached to this component. |
|
48
|
|
|
* @see \yii\base\Component::ensureBehaviors |
|
49
|
|
|
* |
|
50
|
|
|
* @method static null|\yii\base\Behavior getBehavior(string $name) Returns the named behavior object. |
|
51
|
|
|
* @see \yii\base\Component::getBehavior |
|
52
|
|
|
* |
|
53
|
|
|
* @method static \yii\base\Behavior[] getBehaviors() Returns all behaviors attached to this component. |
|
54
|
|
|
* @see \yii\base\Component::getBehaviors |
|
55
|
|
|
* |
|
56
|
|
|
* @method static string getDriverName() Returns the name of the DB driver. |
|
57
|
|
|
* @see \yii\db\Connection::getDriverName |
|
58
|
|
|
* |
|
59
|
|
|
* @method static bool getIsActive() Returns a value indicating whether the DB connection is established. |
|
60
|
|
|
* @see \yii\db\Connection::getIsActive |
|
61
|
|
|
* |
|
62
|
|
|
* @method static string getLastInsertID(string $sequenceName = '') Returns the ID of the last inserted row or sequence value. |
|
63
|
|
|
* @see \yii\db\Connection::getLastInsertID |
|
64
|
|
|
* |
|
65
|
|
|
* @method static \yii\db\Connection getMaster() Returns the currently active master connection. |
|
66
|
|
|
* @see \yii\db\Connection::getMaster |
|
67
|
|
|
* |
|
68
|
|
|
* @method static \PDO getMasterPdo() Returns the PDO instance for the currently active master connection. |
|
69
|
|
|
* @see \yii\db\Connection::getMasterPdo |
|
70
|
|
|
* |
|
71
|
|
|
* @method static \yii\db\QueryBuilder getQueryBuilder() Returns the query builder for the current DB connection. |
|
72
|
|
|
* @see \yii\db\Connection::getQueryBuilder |
|
73
|
|
|
* |
|
74
|
|
|
* @method static array getQueryCacheInfo(int $duration, \yii\caching\Dependency $dependency) Returns the current query cache information. |
|
75
|
|
|
* @see \yii\db\Connection::getQueryCacheInfo |
|
76
|
|
|
* |
|
77
|
|
|
* @method static \yii\db\Schema getSchema() Returns the schema information for the database opened by this connection. |
|
78
|
|
|
* @see \yii\db\Connection::getSchema |
|
79
|
|
|
* |
|
80
|
|
|
* @method static \yii\db\Connection getSlave(bool $fallbackToMaster = true) Returns the currently active slave connection. |
|
81
|
|
|
* @see \yii\db\Connection::getSlave |
|
82
|
|
|
* |
|
83
|
|
|
* @method static \PDO getSlavePdo(bool $fallbackToMaster = true) Returns the PDO instance for the currently active slave connection. |
|
84
|
|
|
* @see \yii\db\Connection::getSlavePdo |
|
85
|
|
|
* |
|
86
|
|
|
* @method static \yii\db\TableSchema getTableSchema(string $name, bool $refresh = false) Obtains the schema information for the named table. |
|
87
|
|
|
* @see \yii\db\Connection::getTableSchema |
|
88
|
|
|
* |
|
89
|
|
|
* @method static \yii\db\Transaction getTransaction() Returns the currently active transaction. |
|
90
|
|
|
* @see \yii\db\Connection::getTransaction |
|
91
|
|
|
* |
|
92
|
|
|
* @method static bool hasEventHandlers(string $name) Returns a value indicating whether there is any handler attached to the named event. |
|
93
|
|
|
* @see \yii\base\Component::hasEventHandlers |
|
94
|
|
|
* |
|
95
|
|
|
* @method static mixed noCache(callable $callable) Disables query cache temporarily. |
|
96
|
|
|
* @see \yii\db\Connection::noCache |
|
97
|
|
|
* |
|
98
|
|
|
* @method static bool off(string $name, callable $handler = null) Detaches an existing event handler from this component. |
|
99
|
|
|
* @see \yii\base\Component::off |
|
100
|
|
|
* |
|
101
|
|
|
* @method static void on(string $name, callable $handler, mixed $data = null, bool $append = true) Attaches an event handler to an event. |
|
102
|
|
|
* @see \yii\base\Component::on |
|
103
|
|
|
* |
|
104
|
|
|
* @method static void open() Establishes a DB connection. |
|
105
|
|
|
* @see \yii\db\Connection::open |
|
106
|
|
|
* |
|
107
|
|
|
* @method static string quoteColumnName(string $name) Quotes a column name for use in a query. |
|
108
|
|
|
* @see \yii\db\Connection::quoteColumnName |
|
109
|
|
|
* |
|
110
|
|
|
* @method static string quoteSql(string $sql) Processes a SQL statement by quoting table and column names that are enclosed within double brackets. |
|
111
|
|
|
* @see \yii\db\Connection::quoteSql |
|
112
|
|
|
* |
|
113
|
|
|
* @method static string quoteTableName(string $name) Quotes a table name for use in a query. |
|
114
|
|
|
* @see \yii\db\Connection::quoteTableName |
|
115
|
|
|
* |
|
116
|
|
|
* @method static string quoteValue(string $value) Quotes a string value for use in a query. |
|
117
|
|
|
* @see \yii\db\Connection::quoteValue |
|
118
|
|
|
* |
|
119
|
|
|
* @method static void setDriverName(string $driverName) Changes the current driver name. |
|
120
|
|
|
* @see \yii\db\Connection::setDriverName |
|
121
|
|
|
* |
|
122
|
|
|
* @method static mixed transaction(callable $callback, string|null $isolationLevel = null) Executes callback provided in a transaction. |
|
123
|
|
|
* @see \yii\db\Connection::transaction |
|
124
|
|
|
* |
|
125
|
|
|
* @method static void trigger(string $name, \yii\base\Event $event = null) Triggers an event. |
|
126
|
|
|
* @see \yii\base\Component::trigger |
|
127
|
|
|
* |
|
128
|
|
|
* @method static mixed useMaster(callable $callback) Executes the provided callback by using the master connection. |
|
129
|
|
|
* @see \yii\db\Connection::useMaster |
|
130
|
|
|
* |
|
131
|
|
|
* Property accessors |
|
132
|
|
|
* |
|
133
|
|
|
* @method static array getAttributes() Returns PDO attributes (name => value) that should be set when calling [[open()]] to establish a DB connection. |
|
134
|
|
|
* @see \yii\db\Connection::attributes |
|
135
|
|
|
* |
|
136
|
|
|
* @method static string getCharset() Returns the charset used for database connection. |
|
137
|
|
|
* @see \yii\db\Connection::charset |
|
138
|
|
|
* |
|
139
|
|
|
* @method static string getCommandClass() Returns the class used to create new database [[Command]] objects. |
|
140
|
|
|
* @see \yii\db\Connection::commandClass |
|
141
|
|
|
* |
|
142
|
|
|
* @method static string getDsn() Returns the Data Source Name, or DSN, contains the information required to connect to the database. |
|
143
|
|
|
* @see \yii\db\Connection::dsn |
|
144
|
|
|
* |
|
145
|
|
|
* @method static bool getEmulatePrepare() Returns whether to turn on prepare emulation. |
|
146
|
|
|
* @see \yii\db\Connection::emulatePrepare |
|
147
|
|
|
* |
|
148
|
|
|
* @method static bool getEnableLogging() Returns whether to enable logging of database queries. |
|
149
|
|
|
* @see \yii\db\Connection::enableLogging |
|
150
|
|
|
* |
|
151
|
|
|
* @method static bool getEnableProfiling() Returns whether to enable profiling of database queries. |
|
152
|
|
|
* @see \yii\db\Connection::enableProfiling |
|
153
|
|
|
* |
|
154
|
|
|
* @method static bool getEnableQueryCache() Returns whether to enable query caching. |
|
155
|
|
|
* @see \yii\db\Connection::enableQueryCache |
|
156
|
|
|
* |
|
157
|
|
|
* @method static bool getEnableSavepoint() Returns whether to enable [savepoint](http://en.wikipedia.org/wiki/Savepoint). |
|
158
|
|
|
* @see \yii\db\Connection::enableSavepoint |
|
159
|
|
|
* |
|
160
|
|
|
* @method static bool getEnableSchemaCache() Returns whether to enable schema caching. |
|
161
|
|
|
* @see \yii\db\Connection::enableSchemaCache |
|
162
|
|
|
* |
|
163
|
|
|
* @method static bool getEnableSlaves() Returns whether to enable read/write splitting by using [[slaves]] to read data. |
|
164
|
|
|
* @see \yii\db\Connection::enableSlaves |
|
165
|
|
|
* |
|
166
|
|
|
* @method static array getMasterConfig() Returns the configuration that should be merged with every master configuration listed in [[masters]]. |
|
167
|
|
|
* @see \yii\db\Connection::masterConfig |
|
168
|
|
|
* |
|
169
|
|
|
* @method static array getMasters() Returns list of master connection configurations. |
|
170
|
|
|
* @see \yii\db\Connection::masters |
|
171
|
|
|
* |
|
172
|
|
|
* @method static string getPassword() Returns the password for establishing DB connection. |
|
173
|
|
|
* @see \yii\db\Connection::password |
|
174
|
|
|
* |
|
175
|
|
|
* @method static \PDO getPdo() Returns the PHP PDO instance associated with this DB connection. |
|
176
|
|
|
* @see \yii\db\Connection::pdo |
|
177
|
|
|
* |
|
178
|
|
|
* @method static string getPdoClass() Returns Custom PDO wrapper class. |
|
179
|
|
|
* @see \yii\db\Connection::pdoClass |
|
180
|
|
|
* |
|
181
|
|
|
* @method static \yii\caching\Cache|string getQueryCache() Returns the cache object or the ID of the cache application component that is used for query caching. |
|
182
|
|
|
* @see \yii\db\Connection::queryCache |
|
183
|
|
|
* |
|
184
|
|
|
* @method static int getQueryCacheDuration() Returns the default number of seconds that query results can remain valid in cache. |
|
185
|
|
|
* @see \yii\db\Connection::queryCacheDuration |
|
186
|
|
|
* |
|
187
|
|
|
* @method static \yii\caching\Cache|string getSchemaCache() Returns the cache object or the ID of the cache application component that is used to cache the table metadata. |
|
188
|
|
|
* @see \yii\db\Connection::schemaCache |
|
189
|
|
|
* |
|
190
|
|
|
* @method static int getSchemaCacheDuration() Returns number of seconds that table metadata can remain valid in cache. |
|
191
|
|
|
* @see \yii\db\Connection::schemaCacheDuration |
|
192
|
|
|
* |
|
193
|
|
|
* @method static array getSchemaCacheExclude() Returns list of tables whose metadata should NOT be cached. |
|
194
|
|
|
* @see \yii\db\Connection::schemaCacheExclude |
|
195
|
|
|
* |
|
196
|
|
|
* @method static array getSchemaMap() Returns mapping between PDO driver names and [[Schema]] classes. |
|
197
|
|
|
* @see \yii\db\Connection::schemaMap |
|
198
|
|
|
* |
|
199
|
|
|
* @method static int getServerRetryInterval() Returns the retry interval in seconds for dead servers listed in [[masters]] and [[slaves]]. |
|
200
|
|
|
* @see \yii\db\Connection::serverRetryInterval |
|
201
|
|
|
* |
|
202
|
|
|
* @method static \yii\caching\Cache|string getServerStatusCache() Returns the cache object or the ID of the cache application component that is used to store the health status of the DB servers specified in [[masters]] and [[slaves]]. |
|
203
|
|
|
* @see \yii\db\Connection::serverStatusCache |
|
204
|
|
|
* |
|
205
|
|
|
* @method static bool getShuffleMasters() Returns whether to shuffle [[masters]] before getting one. |
|
206
|
|
|
* @see \yii\db\Connection::shuffleMasters |
|
207
|
|
|
* |
|
208
|
|
|
* @method static array getSlaveConfig() Returns the configuration that should be merged with every slave configuration listed in [[slaves]]. |
|
209
|
|
|
* @see \yii\db\Connection::slaveConfig |
|
210
|
|
|
* |
|
211
|
|
|
* @method static array getSlaves() Returns list of slave connection configurations. |
|
212
|
|
|
* @see \yii\db\Connection::slaves |
|
213
|
|
|
* |
|
214
|
|
|
* @method static string getTablePrefix() Returns the common prefix or suffix for table names. |
|
215
|
|
|
* @see \yii\db\Connection::tablePrefix |
|
216
|
|
|
* |
|
217
|
|
|
* @method static string getUsername() Returns the username for establishing DB connection. |
|
218
|
|
|
* @see \yii\db\Connection::username |
|
219
|
|
|
* |
|
220
|
|
|
* @method static void setAttributes(array $value) Sets PDO attributes (name => value) that should be set when calling [[open()]] to establish a DB connection. |
|
221
|
|
|
* @see \yii\db\Connection::attributes |
|
222
|
|
|
* |
|
223
|
|
|
* @method static void setCharset(string $value) Sets the charset used for database connection. |
|
224
|
|
|
* @see \yii\db\Connection::charset |
|
225
|
|
|
* |
|
226
|
|
|
* @method static void setCommandClass(string $value) Sets the class used to create new database [[Command]] objects. |
|
227
|
|
|
* @see \yii\db\Connection::commandClass |
|
228
|
|
|
* |
|
229
|
|
|
* @method static void setDsn(string $value) Sets the Data Source Name, or DSN, contains the information required to connect to the database. |
|
230
|
|
|
* @see \yii\db\Connection::dsn |
|
231
|
|
|
* |
|
232
|
|
|
* @method static void setEmulatePrepare(bool $value) Sets whether to turn on prepare emulation. |
|
233
|
|
|
* @see \yii\db\Connection::emulatePrepare |
|
234
|
|
|
* |
|
235
|
|
|
* @method static void setEnableLogging(bool $value) Sets whether to enable logging of database queries. |
|
236
|
|
|
* @see \yii\db\Connection::enableLogging |
|
237
|
|
|
* |
|
238
|
|
|
* @method static void setEnableProfiling(bool $value) Sets whether to enable profiling of database queries. |
|
239
|
|
|
* @see \yii\db\Connection::enableProfiling |
|
240
|
|
|
* |
|
241
|
|
|
* @method static void setEnableQueryCache(bool $value) Sets whether to enable query caching. |
|
242
|
|
|
* @see \yii\db\Connection::enableQueryCache |
|
243
|
|
|
* |
|
244
|
|
|
* @method static void setEnableSavepoint(bool $value) Sets whether to enable [savepoint](http://en.wikipedia.org/wiki/Savepoint). |
|
245
|
|
|
* @see \yii\db\Connection::enableSavepoint |
|
246
|
|
|
* |
|
247
|
|
|
* @method static void setEnableSchemaCache(bool $value) Sets whether to enable schema caching. |
|
248
|
|
|
* @see \yii\db\Connection::enableSchemaCache |
|
249
|
|
|
* |
|
250
|
|
|
* @method static void setEnableSlaves(bool $value) Sets whether to enable read/write splitting by using [[slaves]] to read data. |
|
251
|
|
|
* @see \yii\db\Connection::enableSlaves |
|
252
|
|
|
* |
|
253
|
|
|
* @method static void setMasterConfig(array $value) Sets the configuration that should be merged with every master configuration listed in [[masters]]. |
|
254
|
|
|
* @see \yii\db\Connection::masterConfig |
|
255
|
|
|
* |
|
256
|
|
|
* @method static void setMasters(array $value) Sets list of master connection configurations. |
|
257
|
|
|
* @see \yii\db\Connection::masters |
|
258
|
|
|
* |
|
259
|
|
|
* @method static void setPassword(string $value) Sets the password for establishing DB connection. |
|
260
|
|
|
* @see \yii\db\Connection::password |
|
261
|
|
|
* |
|
262
|
|
|
* @method static void setPdo(\PDO $value) Sets the PHP PDO instance associated with this DB connection. |
|
263
|
|
|
* @see \yii\db\Connection::pdo |
|
264
|
|
|
* |
|
265
|
|
|
* @method static void setPdoClass(string $value) Sets Custom PDO wrapper class. |
|
266
|
|
|
* @see \yii\db\Connection::pdoClass |
|
267
|
|
|
* |
|
268
|
|
|
* @method static void setQueryCache(\yii\caching\Cache|string $value) Sets the cache object or the ID of the cache application component that is used for query caching. |
|
269
|
|
|
* @see \yii\db\Connection::queryCache |
|
270
|
|
|
* |
|
271
|
|
|
* @method static void setQueryCacheDuration(int $value) Sets the default number of seconds that query results can remain valid in cache. |
|
272
|
|
|
* @see \yii\db\Connection::queryCacheDuration |
|
273
|
|
|
* |
|
274
|
|
|
* @method static void setSchemaCache(\yii\caching\Cache|string $value) Sets the cache object or the ID of the cache application component that is used to cache the table metadata. |
|
275
|
|
|
* @see \yii\db\Connection::schemaCache |
|
276
|
|
|
* |
|
277
|
|
|
* @method static void setSchemaCacheDuration(int $value) Sets number of seconds that table metadata can remain valid in cache. |
|
278
|
|
|
* @see \yii\db\Connection::schemaCacheDuration |
|
279
|
|
|
* |
|
280
|
|
|
* @method static void setSchemaCacheExclude(array $value) Sets list of tables whose metadata should NOT be cached. |
|
281
|
|
|
* @see \yii\db\Connection::schemaCacheExclude |
|
282
|
|
|
* |
|
283
|
|
|
* @method static void setSchemaMap(array $value) Sets mapping between PDO driver names and [[Schema]] classes. |
|
284
|
|
|
* @see \yii\db\Connection::schemaMap |
|
285
|
|
|
* |
|
286
|
|
|
* @method static void setServerRetryInterval(int $value) Sets the retry interval in seconds for dead servers listed in [[masters]] and [[slaves]]. |
|
287
|
|
|
* @see \yii\db\Connection::serverRetryInterval |
|
288
|
|
|
* |
|
289
|
|
|
* @method static void setServerStatusCache(\yii\caching\Cache|string $value) Sets the cache object or the ID of the cache application component that is used to store the health status of the DB servers specified in [[masters]] and [[slaves]]. |
|
290
|
|
|
* @see \yii\db\Connection::serverStatusCache |
|
291
|
|
|
* |
|
292
|
|
|
* @method static void setShuffleMasters(bool $value) Sets whether to shuffle [[masters]] before getting one. |
|
293
|
|
|
* @see \yii\db\Connection::shuffleMasters |
|
294
|
|
|
* |
|
295
|
|
|
* @method static void setSlaveConfig(array $value) Sets the configuration that should be merged with every slave configuration listed in [[slaves]]. |
|
296
|
|
|
* @see \yii\db\Connection::slaveConfig |
|
297
|
|
|
* |
|
298
|
|
|
* @method static void setSlaves(array $value) Sets list of slave connection configurations. |
|
299
|
|
|
* @see \yii\db\Connection::slaves |
|
300
|
|
|
* |
|
301
|
|
|
* @method static void setTablePrefix(string $value) Sets the common prefix or suffix for table names. |
|
302
|
|
|
* @see \yii\db\Connection::tablePrefix |
|
303
|
|
|
* |
|
304
|
|
|
* @method static void setUsername(string $value) Sets the username for establishing DB connection. |
|
305
|
|
|
* @see \yii\db\Connection::username |
|
306
|
|
|
*/ |
|
307
|
|
|
class Db extends Facade |
|
308
|
|
|
{ |
|
309
|
|
|
/** |
|
310
|
|
|
* @inheritDoc |
|
311
|
|
|
*/ |
|
312
|
1 |
|
public static function getFacadeComponentId() |
|
313
|
|
|
{ |
|
314
|
1 |
|
return 'db'; |
|
315
|
|
|
} |
|
316
|
|
|
} |
|
317
|
|
|
|