-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5876 from derrabus/feature/schema-manager-factory
Introduce the `SchemaManagerFactory` interface
- Loading branch information
Showing
10 changed files
with
198 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\DBAL\Schema; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Doctrine\DBAL\Exception; | ||
|
||
/** | ||
* A schema manager factory that returns the default schema manager for the given platform. | ||
*/ | ||
final class DefaultSchemaManagerFactory implements SchemaManagerFactory | ||
{ | ||
/** @throws Exception If the platform does not support creating schema managers yet. */ | ||
public function createSchemaManager(Connection $connection): AbstractSchemaManager | ||
{ | ||
return $connection->getDatabasePlatform()->createSchemaManager($connection); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\DBAL\Schema; | ||
|
||
use Doctrine\DBAL\Connection; | ||
|
||
/** @internal Will be removed in 4.0. */ | ||
final class LegacySchemaManagerFactory implements SchemaManagerFactory | ||
{ | ||
public function createSchemaManager(Connection $connection): AbstractSchemaManager | ||
{ | ||
return $connection->getDriver()->getSchemaManager( | ||
$connection, | ||
$connection->getDatabasePlatform(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\DBAL\Schema; | ||
|
||
use Doctrine\DBAL\Connection; | ||
|
||
/** | ||
* Creates a schema manager for the given connection. | ||
* | ||
* This interface is an extension point for applications that need to override schema managers. | ||
*/ | ||
interface SchemaManagerFactory | ||
{ | ||
public function createSchemaManager(Connection $connection): AbstractSchemaManager; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters