Commit 5a46f577 authored by Benjamin Eberlei's avatar Benjamin Eberlei

[DBAL-756] Add new method AbstractPlatform#getVendor().

parent 2632d4a7
# Upgrade to 2.5
## New abstract method `getVendor` on `AbstractPlatform`
Because we have been getting more and more version specific platforms
it is necessary to detect platforms based on the vendor, not on their version names.
For this a new method `abstract public function getVendor()` was introduced on
the `AbstractPlatform`.
If you have a custom platform that extends from `AbstractPlatform` you need to provide
this method as of version 2.5 of DBAL.
## datetime Type uses date_create() as fallback
Before 2.5 the DateTime type always required a specific format, defined in
......
......@@ -337,6 +337,13 @@ abstract class AbstractPlatform
*/
abstract public function getName();
/**
* Gets the name of the vendor, independent of version.
*
* @return string
*/
abstract public function getVendor();
/**
* Registers a doctrine type to be used in conjunction with a column type of this platform.
*
......
......@@ -107,6 +107,14 @@ class DB2Platform extends AbstractPlatform
return 'db2';
}
/**
* {@inheritDoc}
*/
public function getVendor()
{
return 'db2';
}
/**
* {@inheritDoc}
*/
......
......@@ -40,6 +40,14 @@ class DrizzlePlatform extends AbstractPlatform
return 'drizzle';
}
/**
* {@inheritDoc}
*/
public function getVendor()
{
return 'drizzle';
}
/**
* {@inheritDoc}
*/
......
......@@ -795,6 +795,14 @@ class MySqlPlatform extends AbstractPlatform
return 'mysql';
}
/**
* {@inheritDoc}
*/
public function getVendor()
{
return 'mysql';
}
/**
* {@inheritDoc}
*/
......
......@@ -810,6 +810,14 @@ LEFT JOIN user_cons_columns r_cols
return 'oracle';
}
/**
* {@inheritDoc}
*/
public function getVendor()
{
return 'oracle';
}
/**
* {@inheritDoc}
*/
......
......@@ -874,6 +874,14 @@ class PostgreSqlPlatform extends AbstractPlatform
return 'postgresql';
}
/**
* {@inheritDoc}
*/
public function getVendor()
{
return 'postgresql';
}
/**
* {@inheritDoc}
*
......
......@@ -1005,6 +1005,14 @@ class SQLAnywherePlatform extends AbstractPlatform
return 'sqlanywhere';
}
/**
* {@inheritDoc}
*/
public function getVendor()
{
return 'sqlanywhere';
}
/**
* Obtain DBMS specific SQL code portion needed to set a primary key
* declaration to be used in statements like ALTER TABLE.
......
......@@ -1286,6 +1286,14 @@ class SQLServerPlatform extends AbstractPlatform
return 'mssql';
}
/**
* {@inheritDoc}
*/
public function getVendor()
{
return 'sqlserver';
}
/**
* {@inheritDoc}
*/
......
......@@ -486,6 +486,14 @@ class SqlitePlatform extends AbstractPlatform
return 'sqlite';
}
/**
* {@inheritDoc}
*/
public function getVendor()
{
return 'sqlite';
}
/**
* {@inheritDoc}
*/
......
......@@ -56,6 +56,12 @@ class MockPlatform extends \Doctrine\DBAL\Platforms\AbstractPlatform
{
return 'mock';
}
public function getVendor()
{
return 'mock';
}
protected function initializeDoctrineTypeMappings() {
}
protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
......
......@@ -72,6 +72,10 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
{
return 'mock';
}
public function getVendor()
{
return 'mock';
}
protected function initializeDoctrineTypeMappings() {
}
protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
......
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