Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Invalid
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Security Level: All
-
Labels:
Description
Bug found when generation the Entity, Getters and Setters by using the Command:
> php app/console doctrine:generate:entities YourBundleBundle:YourEntity
In the situation you have a OneToMany relation in the Entity and you did implement the __construct(), then the Console Wont generate the ArrayCollection() !
In the case you did not implement the __construct(), then everything will goes fine when generating them,
Example:
/**
* @ORM\OneToMany(targetEntity=" YourBundleBundle \Entity\ YourEntity ", mappedBy=" YourEntity ")
*/
private $YourAttribut;
public function __construct()
{
$this-> YourAttribut = new \Doctrine\Common\Collections\ArrayCollection();
}
// But in the case you did implement the __construct() before using the Command, let say like this:
public function __construct()
{
$this-> YourOtherAttribut = a_value;
}
In this case, when using the Command to generate Entity, Getters and Setters, the Console Wont generate the ArrayCollection() of the OneToMany relations in the __construct() !
Ala Eddine Khefifi This is expected behavior, since the generator should not change already existing methods