diff --git a/framework/yii/db/Migration.php b/framework/yii/db/Migration.php index 38b1bdc..7c6815b 100644 --- a/framework/yii/db/Migration.php +++ b/framework/yii/db/Migration.php @@ -318,7 +318,7 @@ class Migration extends \yii\base\Component */ public function addPrimaryKey($name, $table, $columns) { - echo " > add primary key $name on $table (".(is_array($columns) ? implode(',',$columns) : $columns).") ..."; + echo " > add primary key $name on $table (".(is_array($columns) ? implode(',', $columns) : $columns).") ..."; $time = microtime(true); $this->db->createCommand()->addPrimaryKey($name, $table, $columns)->execute(); echo " done (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n"; diff --git a/framework/yii/db/QueryBuilder.php b/framework/yii/db/QueryBuilder.php index 0d221bc..d5e8ef1 100644 --- a/framework/yii/db/QueryBuilder.php +++ b/framework/yii/db/QueryBuilder.php @@ -279,17 +279,17 @@ class QueryBuilder extends \yii\base\Object public function addPrimaryKey($name, $table, $columns) { if (is_string($columns)) { - $columns=preg_split('/\s*,\s*/',$columns,-1,PREG_SPLIT_NO_EMPTY); + $columns = preg_split('/\s*,\s*/', $columns, -1, PREG_SPLIT_NO_EMPTY); } - - foreach ($columns as $i=>$col) { - $columns[$i]=$this->db->quoteColumnName($col); + + foreach ($columns as $i => $col) { + $columns[$i] = $this->db->quoteColumnName($col); } return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' ADD CONSTRAINT ' . $this->db->quoteColumnName($name) . ' PRIMARY KEY (' . implode(', ', $columns). ' )'; - } + } /** * Builds a SQL statement for removing a primary key constraint to an existing table. @@ -301,8 +301,7 @@ class QueryBuilder extends \yii\base\Object { return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' DROP CONSTRAINT ' . $this->db->quoteColumnName($name); - - } + } /** * Builds a SQL statement for truncating a DB table. diff --git a/framework/yii/db/sqlite/QueryBuilder.php b/framework/yii/db/sqlite/QueryBuilder.php index 99198ae..be0275a 100644 --- a/framework/yii/db/sqlite/QueryBuilder.php +++ b/framework/yii/db/sqlite/QueryBuilder.php @@ -191,8 +191,8 @@ class QueryBuilder extends \yii\db\QueryBuilder public function addPrimaryKey($name, $table, $columns) { throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.'); - } - + } + /** * Builds a SQL statement for removing a primary key constraint to an existing table. * @param string $name the name of the primary key constraint to be removed. @@ -202,7 +202,6 @@ class QueryBuilder extends \yii\db\QueryBuilder */ public function dropPrimaryKey($name, $table) { - throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.'); - } + throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.'); + } } - diff --git a/framework/yii/rbac/PhpManager.php b/framework/yii/rbac/PhpManager.php index 8ecc75c..3808541 100644 --- a/framework/yii/rbac/PhpManager.php +++ b/framework/yii/rbac/PhpManager.php @@ -356,8 +356,7 @@ class PhpManager extends Manager */ public function saveItem($item, $oldName = null) { - if ($oldName !== null && ($newName = $item->getName()) !== $oldName) // name changed - { + if ($oldName !== null && ($newName = $item->getName()) !== $oldName) { // name changed if (isset($this->_items[$newName])) { throw new InvalidParamException("Unable to change the item name. The name '$newName' is already used by another item."); }