Details
Description
When using the CLI tool to generate your entities Doctrine forces a global namespace on all TypeHints in functions. For example I used the sandbox
See file User.php with function setAddress:
- public function setAddress(Address $address)
Remove this function entirely, so that it can be generated. Then run,
- ./doctrine orm:generate-entities .
Open file User.php and now the function has become:
- public function setAddress(\Address $address)
note the prepended \ for global namespace
This behaviour would be fine if all types would be in the global scope, but they're not. If you use another entity such as Address in the same namespace it should just generate the proper
public function setAddress(Address $address)
Or better yet, generate the Fully Qualified Namespace
Code responsible for this:
http://trac.doctrine-project.org/browser/trunk/lib/Doctrine/ORM/Tools/EntityGenerator.php#L609
sorry but the code you highlight here on trac is 7 months old, the current code is on Git: www.github.com/doctrine/doctrine2
Are you really using Beta 4?