Commit 8f783fbe authored by Alexander's avatar Alexander

Merge pull request #180 from stof/fix_phpdoc

Fixed some phpdoc
parents 924a97eb da06cdb2
This diff is collapsed.
...@@ -32,7 +32,7 @@ use Doctrine\DBAL\DBALException, ...@@ -32,7 +32,7 @@ use Doctrine\DBAL\DBALException,
class DrizzlePlatform extends AbstractPlatform class DrizzlePlatform extends AbstractPlatform
{ {
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getName() public function getName()
{ {
...@@ -40,59 +40,82 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -40,59 +40,82 @@ class DrizzlePlatform extends AbstractPlatform
} }
/** /**
* {@inheritdoc} * {@inheritDoc}
*/ */
public function getIdentifierQuoteCharacter() public function getIdentifierQuoteCharacter()
{ {
return '`'; return '`';
} }
public function getConcatExpression()
/**
* {@inheritDoc}
*/ public function getConcatExpression()
{ {
$args = func_get_args(); $args = func_get_args();
return 'CONCAT(' . join(', ', (array) $args) . ')'; return 'CONCAT(' . join(', ', (array) $args) . ')';
} }
/**
* {@inheritDoc}
*/
public function getDateDiffExpression($date1, $date2) public function getDateDiffExpression($date1, $date2)
{ {
return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')'; return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')';
} }
/**
* {@inheritDoc}
*/
public function getDateAddDaysExpression($date, $days) public function getDateAddDaysExpression($date, $days)
{ {
return 'DATE_ADD(' . $date . ', INTERVAL ' . $days . ' DAY)'; return 'DATE_ADD(' . $date . ', INTERVAL ' . $days . ' DAY)';
} }
/**
* {@inheritDoc}
*/
public function getDateSubDaysExpression($date, $days) public function getDateSubDaysExpression($date, $days)
{ {
return 'DATE_SUB(' . $date . ', INTERVAL ' . $days . ' DAY)'; return 'DATE_SUB(' . $date . ', INTERVAL ' . $days . ' DAY)';
} }
/**
* {@inheritDoc}
*/
public function getDateAddMonthExpression($date, $months) public function getDateAddMonthExpression($date, $months)
{ {
return 'DATE_ADD(' . $date . ', INTERVAL ' . $months . ' MONTH)'; return 'DATE_ADD(' . $date . ', INTERVAL ' . $months . ' MONTH)';
} }
/**
* {@inheritDoc}
*/
public function getDateSubMonthExpression($date, $months) public function getDateSubMonthExpression($date, $months)
{ {
return 'DATE_SUB(' . $date . ', INTERVAL ' . $months . ' MONTH)'; return 'DATE_SUB(' . $date . ', INTERVAL ' . $months . ' MONTH)';
} }
/** /**
* @override * {@inheritDoc}
*/ */
public function getBooleanTypeDeclarationSQL(array $field) public function getBooleanTypeDeclarationSQL(array $field)
{ {
return 'BOOLEAN'; return 'BOOLEAN';
} }
/**
* {@inheritDoc}
*/
public function getIntegerTypeDeclarationSQL(array $field) public function getIntegerTypeDeclarationSQL(array $field)
{ {
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
} }
/**
* {@inheritDoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
{ {
$autoinc = ''; $autoinc = '';
...@@ -102,22 +125,33 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -102,22 +125,33 @@ class DrizzlePlatform extends AbstractPlatform
return $autoinc; return $autoinc;
} }
/**
* {@inheritDoc}
*/
public function getBigIntTypeDeclarationSQL(array $field) public function getBigIntTypeDeclarationSQL(array $field)
{ {
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
} }
/**
* {@inheritDoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field) public function getSmallIntTypeDeclarationSQL(array $field)
{ {
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
} }
/**
* {@inheritDoc}
*/
protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
{ {
return $length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'; return $length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)';
} }
/**
* {@inheritDoc}
*/
protected function initializeDoctrineTypeMappings() protected function initializeDoctrineTypeMappings()
{ {
$this->doctrineTypeMapping = array( $this->doctrineTypeMapping = array(
...@@ -136,24 +170,33 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -136,24 +170,33 @@ class DrizzlePlatform extends AbstractPlatform
); );
} }
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $field)
{ {
return 'TEXT'; return 'TEXT';
} }
/** /**
* Gets the SQL Snippet used to declare a BLOB column type. * {@inheritDoc}
*/ */
public function getBlobTypeDeclarationSQL(array $field) public function getBlobTypeDeclarationSQL(array $field)
{ {
return 'BLOB'; return 'BLOB';
} }
/**
* {@inheritDoc}
*/
public function getCreateDatabaseSQL($name) public function getCreateDatabaseSQL($name)
{ {
return 'CREATE DATABASE ' . $name; return 'CREATE DATABASE ' . $name;
} }
/**
* {@inheritDoc}
*/
public function getDropDatabaseSQL($name) public function getDropDatabaseSQL($name)
{ {
return 'DROP DATABASE ' . $name; return 'DROP DATABASE ' . $name;
...@@ -164,6 +207,9 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -164,6 +207,9 @@ class DrizzlePlatform extends AbstractPlatform
return "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE CATALOG_NAME='LOCAL'"; return "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE CATALOG_NAME='LOCAL'";
} }
/**
* {@inheritDoc}
*/
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\DrizzleKeywords'; return 'Doctrine\DBAL\Platforms\Keywords\DrizzleKeywords';
...@@ -201,6 +247,9 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -201,6 +247,9 @@ class DrizzlePlatform extends AbstractPlatform
" WHERE CONSTRAINT_SCHEMA=" . $database . " AND CONSTRAINT_TABLE='" . $table . "'"; " WHERE CONSTRAINT_SCHEMA=" . $database . " AND CONSTRAINT_TABLE='" . $table . "'";
} }
/**
* {@inheritDoc}
*/
public function getListTableIndexesSQL($table, $database = null) public function getListTableIndexesSQL($table, $database = null)
{ {
if ($database) { if ($database) {
...@@ -214,37 +263,52 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -214,37 +263,52 @@ class DrizzlePlatform extends AbstractPlatform
" WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME='" . $table . "'"; " WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME='" . $table . "'";
} }
/**
* {@inheritDoc}
*/
public function prefersIdentityColumns() public function prefersIdentityColumns()
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function supportsIdentityColumns() public function supportsIdentityColumns()
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function supportsInlineColumnComments() public function supportsInlineColumnComments()
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function supportsViews() public function supportsViews()
{ {
return false; return false;
} }
/**
* {@inheritDoc}
*/
public function getDropIndexSQL($index, $table=null) public function getDropIndexSQL($index, $table=null)
{ {
if($index instanceof Index) { if ($index instanceof Index) {
$indexName = $index->getQuotedName($this); $indexName = $index->getQuotedName($this);
} else if(is_string($index)) { } else if (is_string($index)) {
$indexName = $index; $indexName = $index;
} else { } else {
throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.'); throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
} }
if($table instanceof Table) { if ($table instanceof Table) {
$table = $table->getQuotedName($this); $table = $table->getQuotedName($this);
} else if(!is_string($table)) { } else if(!is_string($table)) {
throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
...@@ -262,36 +326,44 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -262,36 +326,44 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* @param Index $index * @param Index $index
* @param Table $table * @param Table $table
*
* @return string
*/ */
protected function getDropPrimaryKeySQL($table) protected function getDropPrimaryKeySQL($table)
{ {
return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY'; return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
} }
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
{ {
if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] == true) { if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] == true) {
return 'TIMESTAMP'; return 'TIMESTAMP';
} else {
return 'DATETIME';
} }
return 'DATETIME';
} }
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
{ {
return 'TIME'; return 'TIME';
} }
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $fieldDeclaration)
{ {
return 'DATE'; return 'DATE';
} }
/** /**
* C/P from mysql platform * {@inheritDoc}
*
* @param TableDiff $diff
* @return string
*/ */
public function getAlterTableSQL(TableDiff $diff) public function getAlterTableSQL(TableDiff $diff)
{ {
...@@ -302,7 +374,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -302,7 +374,7 @@ class DrizzlePlatform extends AbstractPlatform
$queryParts[] = 'RENAME TO ' . $diff->newName; $queryParts[] = 'RENAME TO ' . $diff->newName;
} }
foreach ($diff->addedColumns as $fieldName => $column) { foreach ($diff->addedColumns as $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue; continue;
} }
...@@ -361,9 +433,12 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -361,9 +433,12 @@ class DrizzlePlatform extends AbstractPlatform
return array_merge($sql, $tableSql, $columnSql); return array_merge($sql, $tableSql, $columnSql);
} }
/**
* {@inheritDoc}
*/
public function getDropTemporaryTableSQL($table) public function getDropTemporaryTableSQL($table)
{ {
if ($table instanceof \Doctrine\DBAL\Schema\Table) { if ($table instanceof Table) {
$table = $table->getQuotedName($this); $table = $table->getQuotedName($this);
} else if(!is_string($table)) { } else if(!is_string($table)) {
throw new \InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); throw new \InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
...@@ -372,6 +447,9 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -372,6 +447,9 @@ class DrizzlePlatform extends AbstractPlatform
return 'DROP TEMPORARY TABLE ' . $table; return 'DROP TEMPORARY TABLE ' . $table;
} }
/**
* {@inheritDoc}
*/
public function convertBooleans($item) public function convertBooleans($item)
{ {
if (is_array($item)) { if (is_array($item)) {
...@@ -380,28 +458,36 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -380,28 +458,36 @@ class DrizzlePlatform extends AbstractPlatform
$item[$key] = ($value) ? 'true' : 'false'; $item[$key] = ($value) ? 'true' : 'false';
} }
} }
} else { } else if (is_bool($item) || is_numeric($item)) {
if (is_bool($item) || is_numeric($item)) {
$item = ($item) ? 'true' : 'false'; $item = ($item) ? 'true' : 'false';
} }
}
return $item; return $item;
} }
/**
* {@inheritDoc}
*/
public function getLocateExpression($str, $substr, $startPos = false) public function getLocateExpression($str, $substr, $startPos = false)
{ {
if ($startPos == false) { if ($startPos == false) {
return 'LOCATE(' . $substr . ', ' . $str . ')'; return 'LOCATE(' . $substr . ', ' . $str . ')';
} else {
return 'LOCATE(' . $substr . ', ' . $str . ', '.$startPos.')';
} }
return 'LOCATE(' . $substr . ', ' . $str . ', '.$startPos.')';
} }
/**
* {@inheritDoc}
*/
public function getGuidExpression() public function getGuidExpression()
{ {
return 'UUID()'; return 'UUID()';
} }
/**
* {@inheritDoc}
*/
public function getRegexpExpression() public function getRegexpExpression()
{ {
return 'RLIKE'; return 'RLIKE';
......
...@@ -30,6 +30,9 @@ use Doctrine\DBAL\Schema\Table; ...@@ -30,6 +30,9 @@ use Doctrine\DBAL\Schema\Table;
*/ */
class SQLAzurePlatform extends SQLServer2008Platform class SQLAzurePlatform extends SQLServer2008Platform
{ {
/**
* {@inheritDoc}
*/
public function getCreateTableSQL(Table $table, $createFlags=self::CREATE_INDEXES) public function getCreateTableSQL(Table $table, $createFlags=self::CREATE_INDEXES)
{ {
$sql = parent::getCreateTableSQL($table, $createFlags); $sql = parent::getCreateTableSQL($table, $createFlags);
...@@ -41,6 +44,7 @@ class SQLAzurePlatform extends SQLServer2008Platform ...@@ -41,6 +44,7 @@ class SQLAzurePlatform extends SQLServer2008Platform
$sql[0] = $sql[0] . $stmt; $sql[0] = $sql[0] . $stmt;
} }
return $sql; return $sql;
} }
} }
......
...@@ -36,14 +36,16 @@ namespace Doctrine\DBAL\Platforms; ...@@ -36,14 +36,16 @@ namespace Doctrine\DBAL\Platforms;
class SQLServer2005Platform extends SQLServerPlatform class SQLServer2005Platform extends SQLServerPlatform
{ {
/** /**
* @override * {@inheritDoc}
*/ */
public function supportsLimitOffset() public function supportsLimitOffset()
{ {
return true; return true;
} }
/** @override */ /**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $field)
{ {
return 'VARCHAR(MAX)'; return 'VARCHAR(MAX)';
......
...@@ -28,7 +28,7 @@ namespace Doctrine\DBAL\Platforms; ...@@ -28,7 +28,7 @@ namespace Doctrine\DBAL\Platforms;
class SQLServer2008Platform extends SQLServer2005Platform class SQLServer2008Platform extends SQLServer2005Platform
{ {
/** /**
* @override * {@inheritDoc}
*/ */
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
{ {
...@@ -38,7 +38,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -38,7 +38,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
} }
/** /**
* @override * {@inheritDoc}
*/ */
public function getDateTypeDeclarationSQL(array $fieldDeclaration) public function getDateTypeDeclarationSQL(array $fieldDeclaration)
{ {
...@@ -46,7 +46,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -46,7 +46,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
} }
/** /**
* @override * {@inheritDoc}
*/ */
public function getTimeTypeDeclarationSQL(array $fieldDeclaration) public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
{ {
...@@ -54,7 +54,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -54,7 +54,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
} }
/** /**
* @override * {@inheritDoc}
*/ */
public function getDateTimeFormatString() public function getDateTimeFormatString()
{ {
...@@ -62,7 +62,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -62,7 +62,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
} }
/** /**
* @override * {@inheritDoc}
*/ */
public function getDateTimeTzFormatString() public function getDateTimeTzFormatString()
{ {
...@@ -70,7 +70,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -70,7 +70,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
} }
/** /**
* @override * {@inheritDoc}
*/ */
public function getDateFormatString() public function getDateFormatString()
{ {
...@@ -78,7 +78,7 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -78,7 +78,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
} }
/** /**
* @override * {@inheritDoc}
*/ */
public function getTimeFormatString() public function getTimeFormatString()
{ {
...@@ -86,6 +86,8 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -86,6 +86,8 @@ class SQLServer2008Platform extends SQLServer2005Platform
} }
/** /**
* {@inheritDoc}
*
* Adding Datetime2 Type * Adding Datetime2 Type
*/ */
protected function initializeDoctrineTypeMappings() protected function initializeDoctrineTypeMappings()
......
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