php bin/console doctrine:mapping:import
Imports mapping information from an existing database
Usage
doctrine:mapping:import [--em [EM]] [--shard SHARD] [--filter FILTER] [--force] [--path PATH] [--] <name> [<mapping-type>]
Arguments
name The bundle or namespace to import the mapping information to
mapping-type The mapping type to export the imported mapping information to
Options
--em The entity manager to use for this command
--shard The shard connection to use for this command
--filter A string pattern used to match entities that should be mapped.
--force Force to overwrite existing mapping files.
--path The path where the files would be generated (not used when a bundle is passed).
Help
The doctrine:mapping:import command imports mapping information
from an existing database:
Generate annotation mappings into the src/ directory using App as the namespace:
php bin/console doctrine:mapping:import App\\Entity annotation --path=src/Entity
Generate xml mappings into the config/doctrine/ directory using App as the namespace:
php bin/console doctrine:mapping:import App\\Entity xml --path=config/doctrine
Generate XML mappings into a bundle:
php bin/console doctrine:mapping:import "MyCustomBundle" xml
You can also optionally specify which entity manager to import from with the
--em option:
php bin/console doctrine:mapping:import "MyCustomBundle" xml --em=default
If you don't want to map every entity that can be found in the database, use the
--filter option. It will try to match the targeted mapped entity with the
provided pattern string.
php bin/console doctrine:mapping:import "MyCustomBundle" xml --filter=MyMatchedEntity
Use the --force option, if you want to override existing mapping files:
php bin/console doctrine:mapping:import "MyCustomBundle" xml --force