Doctrine without setters

Viewed 3592

I have been reading about Domain Driven Design and that entities should not have setters. It makes sense to pass the properties in the constructor, so the object is solid. Is there a way to use Doctrine ORM with this practice?

class User
{
    private $firstname;

    public function __construct($firstname)
    {
        $this->firstname = $firstname;
    }
}

How can Doctrine deal with this setup? Any drawbacks?

1 Answers
Related