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?
You will come across many drawbacks, like:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With