Created
September 18, 2020 09:52
-
-
Save botris/f21177dc4f0dd9191966524ad3c85263 to your computer and use it in GitHub Desktop.
Drupal/legacy table to Symfony Doctrine entity
This file contains hidden or 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
DATABASE_URL=mysql://db:db@localhost/db?sslmode=disable&charset=utf8mb4&serverVersion=5.7 | |
DATABASE_DRUPAL_URL=mysql://db:db@localhost/legacy?sslmode=disable&charset=utf8mb4&serverVersion=5.7 |
This file contains hidden or 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
# config/packages/doctrine.yaml | |
doctrine: | |
dbal: | |
default_connection: default | |
connections: | |
default: | |
url: '%env(resolve:DATABASE_URL)%' | |
drupal: | |
url: '%env(resolve:DATABASE_DRUPAL_URL)%' | |
schema_filter: /^(table_name)$/ | |
orm: | |
auto_generate_proxy_classes: true | |
default_entity_manager: default | |
entity_managers: | |
default: | |
auto_mapping: true | |
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware | |
connection: default | |
mappings: | |
App: | |
is_bundle: false | |
type: annotation | |
dir: '%kernel.project_dir%/src/Entity' | |
prefix: 'App\Entity' | |
alias: App | |
drupal: | |
connection: drupal | |
mappings: | |
App: | |
is_bundle: false | |
type: annotation | |
dir: '%kernel.project_dir%/src/Entity/Drupal' | |
prefix: 'App\Entity\Drupal' | |
alias: App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create folder "src/Entity/Drupal".
Run
php bin/console doctrine:mapping:import "App\\Entity\\Drupal" annotation --em=drupal --path=src/Entity/Drupal --force