Function findForeignKeyToColumn
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function findForeignKeyToColumn(string $findTableName, string $findColumnName)
{
$foreignKeys = [];
foreach ($this->getTableNames() as $tableName) {
$tableSchema = $this->getTableSchema($tableName);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getTableMetadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getTableMetadata($name, $type, $refresh)
{
$rawName = $this->getRawTableName($name);
$tableSchema = [];
if (!$refresh && \App\Cache::has('tableSchema', $rawName)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method getTableIndexes has a boolean flag argument $refresh, which is a certain sign of a Single Responsibility Principle violation. Open
public function getTableIndexes($name, $refresh = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getTableNames has a boolean flag argument $refresh, which is a certain sign of a Single Responsibility Principle violation. Open
public function getTableNames($schema = '', $refresh = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid using static access to class '\App\Cache' in method 'setTableMetadata'. Open
$tableSchema = \App\Cache::get('tableSchema', $rawName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'getTableMetadata'. Open
\App\Cache::save('tableSchema', $rawName, $tableSchema, \App\Cache::LONG);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'getTableMetadata'. Open
$tableSchema = \App\Cache::get('tableSchema', $rawName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'setTableMetadata'. Open
\App\Cache::save('tableSchema', $rawName, $tableSchema, \App\Cache::LONG);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'refresh'. Open
\App\Cache::clear();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'refreshTableSchema'. Open
\App\Cache::delete('tableSchema', $rawName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'getTableMetadata'. Open
if (!$refresh && \App\Cache::has('tableSchema', $rawName)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '209', column '43'). Open
public function findForeignKeyToColumn(string $findTableName, string $findColumnName)
{
$foreignKeys = [];
foreach ($this->getTableNames() as $tableName) {
$tableSchema = $this->getTableSchema($tableName);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Cache' in method 'setTableMetadata'. Open
if (\App\Cache::has('tableSchema', $rawName)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "tableSchema" 7 times. Open
\App\Cache::delete('tableSchema', $rawName);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Reference to undeclared property \App\Db\Drivers\SchemaTrait->db
Open
$this->db->pdo->exec("SET TRANSACTION ISOLATION LEVEL $level");
- Exclude checks
Reference to undeclared property \App\Db\Drivers\SchemaTrait->db
Open
return str_replace('#__', $this->db->tablePrefix, $name);
- Exclude checks
Return type of getTableIndexes()
is undeclared type \yii\db\IndexConstraint[]
Open
public function getTableIndexes($name, $refresh = false)
- Exclude checks
Reference to undeclared property \App\Db\Drivers\SchemaTrait->db
Open
$this->db->pdo->exec("SAVEPOINT $name");
- Exclude checks
Reference to undeclared property \App\Db\Drivers\SchemaTrait->db
Open
return str_replace('%', $this->db->tablePrefix, $name);
- Exclude checks
Reference to undeclared property \App\Db\Drivers\SchemaTrait->db
Open
$this->db->pdo->exec("RELEASE SAVEPOINT $name");
- Exclude checks
Reference to undeclared property \App\Db\Drivers\SchemaTrait->db
Open
$this->db->pdo->exec("ROLLBACK TO SAVEPOINT $name");
- Exclude checks
Call to undeclared method \App\Db\Drivers\SchemaTrait::findTableNames
Open
$this->_tableNames[$schema] = $this->findTableNames($schema);
- Exclude checks
Call to undeclared method \App\Db\Drivers\SchemaTrait::getTableSchema
Open
$tableSchema = $this->getTableSchema($tableName);
- Exclude checks
Property name "$_tableNames" should not be prefixed with an underscore to indicate visibility Open
private $_tableNames = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* to reflect the database schema change.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name the savepoint name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* This method cleans up all cached table schemas so that they can be re-created later
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Refreshes the particular table schema.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array list of ALL table names in the database
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->_tableNames = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function createSavepoint($name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $_tableNames = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name table name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Creates a new savepoint.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name the savepoint name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* to reflect the database schema change.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function refresh()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Refreshes the schema.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->_tableNames = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Rolls back to a previously created savepoint.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Releases an existing savepoint.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rawName = $this->getRawTableName($name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->db->pdo->exec("RELEASE SAVEPOINT $name");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::clear();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @since 2.0.6
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function refreshTableSchema($name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->db->pdo->exec("SAVEPOINT $name");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function releaseSavepoint($name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('tableSchema', $rawName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name the savepoint name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* This method cleans up cached table schema so that it can be re-created later
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Returns the actual name of a given table name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return str_replace('#__', $this->db->tablePrefix, $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* If there's no metadata in the cache, this method will call
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = \App\Cache::get('tableSchema', $rawName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $tableSchema[$type];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $type metadata type.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* and replace the percentage character '%' with [[Connection::tablePrefix]].
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string the real name of the given table name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name table name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = \App\Cache::get('tableSchema', $rawName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = preg_replace('/\\{\\{(.*?)\\}\\}/', '\1', $name);
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->_tableNames[$schema] = $this->findTableNames($schema);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return mixed metadata.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Cache::has('tableSchema', $rawName)) {
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
* This can be one of [[Transaction::READ_UNCOMMITTED]], [[Transaction::READ_COMMITTED]], [[Transaction::REPEATABLE_READ]]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $findTableName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function findForeignKeyToColumn(string $findTableName, string $findColumnName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* a `'loadTable' . ucfirst($type)` named method with the table name to obtain the metadata.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($findTableName === $value[0] && ($key = array_search($findColumnName, $value))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \yii\db\IndexConstraint[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getTableMetadata($name, 'indexes', $refresh);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
* and [[Transaction::SERIALIZABLE]] but also a string containing DBMS specific syntax to be used
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTableNames($schema = '', $refresh = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$refresh && \App\Cache::has('tableSchema', $rawName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sets the isolation level of the current transaction.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $level The transaction isolation level to use for this transaction.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* after `SET TRANSACTION ISOLATION LEVEL`.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->db->pdo->exec("SET TRANSACTION ISOLATION LEVEL $level");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return str_replace('%', $this->db->tablePrefix, $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Returns the metadata of the given type for the given table.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $type metadata type.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $refresh whether to reload the table metadata even if it is found in the cache.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rawName = $this->getRawTableName($name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema[$type] = $data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Returns all table names in the database.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $refresh whether to fetch the latest available table names. If this is false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $this->getTableSchema($tableName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $foreignKeys;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function setTableMetadata($name, $type, $data)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* This can be one of [[Transaction::READ_UNCOMMITTED]], [[Transaction::READ_COMMITTED]], [[Transaction::REPEATABLE_READ]]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string[] all table names in the database.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rawName = $this->getRawTableName($name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('tableSchema', $rawName, $tableSchema, \App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->_tableNames[$schema];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema[$type] = $this->{'loadTable' . ucfirst($type)}($rawName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $data metadata.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $findColumnName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$foreignKeys[$tableName][$name] = ['sourceColumn' => $key];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->db->pdo->exec("ROLLBACK TO SAVEPOINT $name");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== strpos($name, '{{')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* table names fetched previously (if available) will be returned.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @since 2.0.13
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $tableSchema[$type];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Find foreign keys to column.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$foreignKeys = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @see https://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setTransactionIsolationLevel($level)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* This method will strip off curly brackets from the given table name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRawTableName($name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Lists indexes for table.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getTableNames() as $tableName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function rollBackSavepoint($name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* If not empty, the returned table names will be prefixed with the schema name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name table name. The table name may contain schema name if any. Do not quote the table name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function getTableMetadata($name, $type, $refresh)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($tableSchema->foreignKeys) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($tableSchema[$type])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($refresh || !isset($tableSchema[$type])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('tableSchema', $rawName, $tableSchema, \App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sets the metadata of the given type for the given table.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* and [[Transaction::SERIALIZABLE]] but also a string containing DBMS specific syntax to be used
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name the table name to be converted
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->_tableNames[$schema]) || $refresh) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @since 2.0.13
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $refresh
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTableIndexes($name, $refresh = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tableSchema->foreignKeys as $name => $value) {
- Exclude checks