ezsystems / doctrine-dbal-schema
Abstraction layer, on top of Doctrine, for cross-DBMS schema import
Installs: 738 243
Dependents: 33
Suggesters: 0
Security: 0
Stars: 29
Watchers: 21
Forks: 3
Type:ezplatform-bundle
Requires
- php: ^7.3
- doctrine/dbal: ^2.10
- symfony/config: ^5.0
- symfony/dependency-injection: ^5.0
- symfony/http-kernel: ^5.0
- symfony/yaml: ^5.0
Requires (Dev)
- ezsystems/ezplatform-code-style: ^0.4.0
- phpunit/phpunit: ^8.5
- v4.0.0-alpha2
- v4.0.0-alpha1
- 1.0.x-dev
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v1.0.0-rc1
- v1.0.0-beta4
- v1.0.0-beta3
- v1.0.0-beta2
- v1.0.0-beta1
- 0.1.x-dev
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- v0.1.0-rc1
- dev-snapshot-master
- dev-rfc/nameless-indexes
This package is auto-updated.
Last update: 2024-10-30 01:42:41 UTC
README
This Symfony Bundle provides basic abstraction layer for cross-DBMS schema import.
It introduces custom Yaml format for schema definition and provides autowired APIs.
Schema Builder
Provided by APIs defined on the \EzSystems\DoctrineSchema\API\SchemaImporter
interface,
imports given Yaml source string or Yaml file into \Doctrine\DBAL\Schema
object.
Schema Exporter
Provided by APIs defined on the \EzSystems\DoctrineSchema\API\SchemaExporter
interface,
exports given \Doctrine\DBAL\Schema
object to the custom Yaml format.
SchemaBuilder
Provided by APIs defined on the \EzSystems\DoctrineSchema\API\Builder\SchemaBuilder
interface,
is an extensibility point to be used by Symfony-based projects.
The SchemaBuilder
is event-driven. To hook into the process of building schema, a custom EventSubscriber
is required, e.g.
use EzSystems\DoctrineSchema\API\Event\SchemaBuilderEvent; use EzSystems\DoctrineSchema\API\Event\SchemaBuilderEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class BuildSchemaSubscriber implements EventSubscriberInterface { /** * @var string */ private $schemaFilePath; public function __construct(string $schemaFilePath) { $this->schemaFilePath = $schemaFilePath; } /** * Returns an array of events this subscriber wants to listen to. * * @return string[] */ public static function getSubscribedEvents() { return [ SchemaBuilderEvents::BUILD_SCHEMA => ['onBuildSchema', 200], ]; } /** * @param \EzSystems\DoctrineSchema\API\Builder\SchemaBuilderEvent $event */ public function onBuildSchema(SchemaBuilderEvent $event) { $event ->getSchemaBuilder() ->importSchemaFromFile($this->schemaFilePath); } }
Schema provided in this way can be imported into Schema object by e.g.:
public function __construct(SchemaBuilder $schemaBuilder) { $this->schemaBuilder = $schemaBuilder; } public function importSchema() { $schema = $this->schemaBuilder->buildSchema(); // ... }
COPYRIGHT
Copyright (C) 1999-2021 Ibexa AS (formerly eZ Systems AS). All rights reserved.
LICENSE
This source code is available separately under the following licenses:
A - Ibexa Business Use License Agreement (Ibexa BUL), version 2.4 or later versions (as license terms may be updated from time to time) Ibexa BUL is granted by having a valid Ibexa DXP (formerly eZ Platform Enterprise) subscription, as described at: https://www.ibexa.co/product For the full Ibexa BUL license text, please see: https://www.ibexa.co/software-information/licenses-and-agreements (latest version applies)
AND
B - GNU General Public License, version 2 Grants an copyleft open source license with ABSOLUTELY NO WARRANTY. For the full GPL license text, please see: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html