public function createPrimaryKey(array $columnNames, $name = null)
    {
        if ($this->hasPrimaryKey()) {
            throw SchemaException::tablePrimaryKeyAlreadyExists($this->getName());
        }

        $primaryKey = new PrimaryKey($name, $columnNames);
        $this->setPrimaryKey($primaryKey);

        $this->createIndex($columnNames, true, $primaryKey->getName());

        return $primaryKey;
    }
public function createPrimaryKey(array $columnNames, $name = null)
    {
        if ($this->hasPrimaryKey()) {
            throw SchemaException::tablePrimaryKeyAlreadyExists($this->getName());
        }

        $primaryKey = new PrimaryKey($name, $columnNames);
        $this->setPrimaryKey($primaryKey);

        $this->createIndex($columnNames, true, $primaryKey->getName());

        return $primaryKey;
    }
public function createPrimaryKey ( array $ columnNames , $ name = null ) { if ( $ this -> hasPrimaryKey ( ) ) { throw SchemaException :: tablePrimaryKeyAlreadyExists ( $ this -> getName ( ) ) ; } $ primaryKey = new PrimaryKey ( $ name , $ columnNames ) ; $ this -> setPrimaryKey ( $ primaryKey ) ; $ this -> createIndex ( $ columnNames , true , $ primaryKey -> getName ( ) ) ; return $ primaryKey ; }
Creates and adds a new primary key.

@param array  $columnNames The primary key column names.
@param string $name        The primary key name.

@throws \Fridge\DBAL\Exception\SchemaException If a primary key already exists.

@return \Fridge\DBAL\Schema\PrimaryKey The new primary key.
Creates and adds a new primary key .