Bug Report
| Q |
A |
| BC Break |
no |
| Version |
2.9.3 |
Summary
It seems like making a property type nullable like this
#[ORM\Column]
protected ?string $Location = null;
does not translate to the SQL column being nullable, contrary to what the docs say. It still has to be declared in the attribute as #[ORM\Column(nullable: true)].
How to reproduce
- Create an entity using attributes, for example
#[ORM\Table(name: "users")]
class User
{
#[ORM\Id, ORM\Column, ORM\GeneratedValue]
protected int $id;
#[ORM\Column]
protected ?string $Name = null;
}
- Set your mapping driver to "attribute".
- Create a migration with
.\bin\console make:migration
- Inspect the created migration and see that within the up()-method you see
[...] Name VARCHAR(255) NOT NULL [...]
Expected behavior
The last step should have contained [...] Name VARCHAR(255) DEFAULT NULL [...].
I think that @beberlei has been working on the implementation?