I donβt think you can set the namespace when importing from the database, because EntityGenerator takes namespace information from metadata. The database does not have or does not need namespaces, so information does not automatically come from there.
You can try to loop over the $ metadata object and add a namespace to the class names. The code in EntityGenerator that retrieves the namespace is pretty simple:
private function _getNamespace(ClassMetadataInfo $metadata) { return substr($metadata->name, 0, strrpos($metadata->name, '\\')); }
If all else fails, you can always implement your own EntityGenerator so that you can use the namespace to use. We did this in our large project, where other user tasks are performed during the generation process. However, EntityGenerator is not easy to overestimate, many private methods and properties, so you may have to copy and paste all of this.
source share