Browse Source

code style fixes

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
cc0fe1b02c
  1. 2
      framework/yii/db/Migration.php
  2. 7
      framework/yii/db/QueryBuilder.php
  3. 1
      framework/yii/db/sqlite/QueryBuilder.php
  4. 3
      framework/yii/rbac/PhpManager.php

2
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";

7
framework/yii/db/QueryBuilder.php

@ -279,11 +279,11 @@ 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 '
@ -301,7 +301,6 @@ class QueryBuilder extends \yii\base\Object
{
return 'ALTER TABLE ' . $this->db->quoteTableName($table)
. ' DROP CONSTRAINT ' . $this->db->quoteColumnName($name);
}
/**

1
framework/yii/db/sqlite/QueryBuilder.php

@ -205,4 +205,3 @@ class QueryBuilder extends \yii\db\QueryBuilder
throw new NotSupportedException(__METHOD__ . ' is not supported by SQLite.');
}
}

3
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.");
}

Loading…
Cancel
Save