Commit 77cdde2a authored by jeroendedauw's avatar jeroendedauw

Fix CQS issue in _createIndex

parent 41a2709c
...@@ -132,14 +132,14 @@ class Table extends AbstractAsset ...@@ -132,14 +132,14 @@ class Table extends AbstractAsset
*/ */
public function setPrimaryKey(array $columns, $indexName = false) public function setPrimaryKey(array $columns, $indexName = false)
{ {
$primaryKey = $this->_createIndex($columns, $indexName ?: "primary", true, true); $this->_addIndex($this->_createIndex($columns, $indexName ?: "primary", true, true));
foreach ($columns as $columnName) { foreach ($columns as $columnName) {
$column = $this->getColumn($columnName); $column = $this->getColumn($columnName);
$column->setNotnull(true); $column->setNotnull(true);
} }
return $primaryKey; return $this;
} }
/** /**
...@@ -157,7 +157,7 @@ class Table extends AbstractAsset ...@@ -157,7 +157,7 @@ class Table extends AbstractAsset
); );
} }
return $this->_createIndex($columnNames, $indexName, false, false, $flags); return $this->_addIndex($this->_createIndex($columnNames, $indexName, false, false, $flags));
} }
/** /**
...@@ -203,7 +203,7 @@ class Table extends AbstractAsset ...@@ -203,7 +203,7 @@ class Table extends AbstractAsset
); );
} }
return $this->_createIndex($columnNames, $indexName, true, false); return $this->_addIndex($this->_createIndex($columnNames, $indexName, true, false));
} }
/** /**
...@@ -278,7 +278,7 @@ class Table extends AbstractAsset ...@@ -278,7 +278,7 @@ class Table extends AbstractAsset
* @param boolean $isPrimary * @param boolean $isPrimary
* @param array $flags * @param array $flags
* *
* @return self * @return Index
* *
* @throws SchemaException * @throws SchemaException
*/ */
...@@ -298,9 +298,7 @@ class Table extends AbstractAsset ...@@ -298,9 +298,7 @@ class Table extends AbstractAsset
} }
} }
$this->_addIndex(new Index($indexName, $columnNames, $isUnique, $isPrimary, $flags)); return new Index($indexName, $columnNames, $isUnique, $isPrimary, $flags);
return $this;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment