'Doctrine mapping import global namespace for associations
Trying to import a mapping from my database
$ php bin/console doctrine:mapping:import MyBundle annotation
Here is one of my associations generated from a foreign key by Doctrine
/**
* @var \CustomerSite
*
* @ORM\Id
* @ORM\OneToOne(targetEntity="CustomerSite")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="customer_site_id", referencedColumnName="id")
* })
*/
private $customerSite;
As you can see the field is referenced in the global namespace
@var \CustomerSite
It should be
@var CustomerSite
Why does doctrine use the global namespace here ? How do I tell it not to ?
Solution 1:[1]
I use the following two commands before creating getters/setters:
sed -i'' -e 's/@var \\/@var /g' src/Entity/*.php
sed -i'' -e 's/@var Datetime/@var \\Datetime/g' src/Entity/*.php
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ralf Jahr |
