php bin/console doctrine:mapping:convert
Convert mapping information between supported formats
Usage
doctrine:mapping:convert [--em EM] [--filter FILTER] [-f|--force] [--from-database] [--extend [EXTEND]] [--num-spaces [NUM-SPACES]] [--namespace [NAMESPACE]] [--] <to-type> <dest-path>
Arguments
to-type The mapping type to be converted.
dest-path The path to generate your entities classes.
Options
--em Name of the entity manager to operate on
--filter A string pattern used to match entities that should be processed.
-f, --force Force to overwrite existing mapping files.
--from-database Whether or not to convert mapping information from existing database.
--extend Defines a base class to be extended by generated entity classes.
--num-spaces Defines the number of indentation spaces
--namespace Defines a namespace for the generated entity classes, if converted from database.
Help
Convert mapping information between supported formats.
This is an execute one-time command. It should not be necessary for
you to call this method multiple times, especially when using the --from-database
flag.
Converting an existing database schema into mapping files only solves about 70-80%
of the necessary mapping information. Additionally the detection from an existing
database cannot detect inverse associations, inheritance types,
entities with foreign keys as primary keys and many of the
semantical operations on associations such as cascade.
Hint: There is no need to convert YAML or XML mapping files to annotations
every time you make changes. All mapping drivers are first class citizens
in Doctrine 2 and can be used as runtime mapping for the ORM.
Hint: If you have a database with tables that should not be managed
by the ORM, you can use a DBAL functionality to filter the tables and sequences down
on a global level:
$config->setSchemaAssetsFilter(function (string|AbstractAsset $assetName): bool {
if ($assetName instanceof AbstractAsset) {
$assetName = $assetName->getName();
}
return !str_starts_with($assetName, 'audit_');
});