I'm aware of the "default" setting, that's exactly what I'm referring to. If you set this value and let Skipper export the entity in the "Doctrine2 Annotations" format, it would be great if the resulting PHP class could use these default values for the member variables' initialization.
Let's say as a result of the export we get such a class:
/**
* @ORM\Entity
* @ORM\Table(name="foo")
*/
class Foo
{
/**
* @ORM\Column(type="boolean", nullable=false, options={"default":true})
*/
private $visible;
}
What I'm missing is the following initialization:
private $visible = true;
I'm new to Doctrine and am in the process of figuring out which workflow including Skipper and (perhaps) Doctrine CLI tool works for me.
If I see it right, at the moment, after exporting the entities by Skipper, I have to make the initialization manually, otherwise the member variables can have different values as the defined defaults.
What bothers me is the period after creating an entity object until it gets persisted for the first time - if I have member variables which are not initialized, forget about the manual initialization and use the object, my object's "state" is not what you would expect after defining the default values. I guess you can already see what I'm getting at...
The doctrine CLI tool doesn't solve the problem either, since it "only" lets you generate the mutators when updating the entity class (I purposely avoid regenerating the classes, since it removes the custom logic out of the class,... but it also adds the member variable initialization as shown above).