src/Database/QueryBuilder/Commands/Create.php
/**
	 * Compiles the table keys (automatically included in the schema).
	 *
	 * @return string
	 */
Compiles the table keys (automatically included in the schema).
@return string
Compiles the table keys ( automatically included in the schema ) . @return string
public function compileKeys() {
		$compiled = array();
		if (!empty($this->primaryKey)) {
			$compiled[] = sprintf('PRIMARY KEY (%s)', $this->compileColumnList($this->primaryKey));
		}
		foreach ($this->keys as $key) {
			$keyColumns = $key['columns'];
			$keyType = $key['type'];
			if ($keyType == 'FOREIGN KEY') {
				$compiled[] = $this->compileForeignKey($key);
				continue;
			}
			$keyName = StringBuilder::formatColumnName($this->table . '_' . implode('_', $keyColumns));
			$compiled[] = sprintf('%s %s (%s)', $keyType, $keyName, $this->compileColumnList($keyColumns));
		}
		return implode(', ', $compiled);
	}
public function compileKeys ( ) { $ compiled = array ( ) ; if ( ! empty ( $ this -> primaryKey ) ) { $ compiled [ ] = sprintf ( 'PRIMARY KEY (%s)' , $ this -> compileColumnList ( $ this -> primaryKey ) ) ; } foreach ( $ this -> keys as $ key ) { $ keyColumns = $ key [ 'columns' ] ; $ keyType = $ key [ 'type' ] ; if ( $ keyType == 'FOREIGN KEY' ) { $ compiled [ ] = $ this -> compileForeignKey ( $ key ) ; continue ; } $ keyName = StringBuilder :: formatColumnName ( $ this -> table . '_' . implode ( '_' , $ keyColumns ) ) ; $ compiled [ ] = sprintf ( '%s %s (%s)' , $ keyType , $ keyName , $ this -> compileColumnList ( $ keyColumns ) ) ; } return implode ( ', ' , $ compiled ) ; }
Compiles the table keys (automatically included in the schema).
Compiles the table keys ( automatically included in the schema ) .