Open
Description
Hi!
It's a minor syntax mistake, but right now generated setters allow to pass the null value to non nullable fields, if they are ManyToOne relationship.
/**
* @ORM\ManyToOne(targetEntity="App\Entity\AnotherEntity")
* @ORM\JoinColumn(nullable=false)
*/
private $anotherEntity;
//...
public function setAnotherEntity(?AnotherEntity $anotherEntity): self
{
$this->anotherEntity = $anotherEntity;
return $this;
}
The arg should be AnotherEntity
not ?AnotherEntity
Cheers!