0 votes

Can you export DoctrinePhp without the namespace prefix on the filename?

When exporting DoctrinePhp files for zf2 projects, I use the standard psr-0 format for autoloading objects.

Am I missing something because the files get exported to module/CustomModule/src/CustomModule/Entity/CustomModule.Entity.CustomEntity.php which is obviously not what I want? Is there a way to have the namespace automatically set at the top of the entity without it also prefixing the filename? Or if it can prefix the filename, can it use a path separator (/, \) instead of a full stop?



in How To & Manuals by (730 points)
edited by

My apologies, I've only just clicked on the "filename-format" option in the properties pane when you select a module.



1 Answer

0 votes
Best answer

Hi ise,

As you correctly find out, you can choose filename format on Module. But except that there is more ways how to customize your entity's filename.

ORM Designer use following rules to choose output file name:

If nothing is customized, default file name is:

  • for PHP files Namespace.EntityName.php
  • for XML Namespace.EntityName.dcm.xml
  • for YML Namespace.EntityName.dcm.yml

File-name suffix
You can customize file-name suffix in "Module -> file-suffix". Here you can choose between:

  • .dcm. (output file-name will be Entity.dcm.xxx)
  • .orm. (output file-name will be Entity.orm.xxx)
  • without suffix (output file-name will be Entity.xxx)

If no-value is selected, ORM Designer automatically use .dcm. for XML/YML and without for PHP files.

File-name format

Another way how to customize naming convention is Module -> file-name-format attribute. This attribute can have following values:

  • with-namespace (output file will be Namespace.Entity.xxx)
  • entity-name-only (output file will be Entity.xxx)

enter image description here

Custom entity file name

Because sometimes you need to export your entity to completly different file-name (different rules or different name at all), ORM Designer offers a way how to specify custom file-name to each entity independently.

This value can be set-up in "Entity->export-file-name". If you fill this property, all other file-name rules will be ignored.

enter image description here

by Skipper developer (141k points)
selected by