You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm still experimenting with the 2.9.x branch (6753b26) and noticed a strange schema difference.
class Order {
#[ORM\ManyToOne]
#[ORM\JoinColumn]
publicProductVariant$productVariant;
}
class Order {
#[ORM\ManyToOne]
publicProductVariant$productVariant;
}
These 2 definitions create a different schema. The JoinColumn definition creates a NOT NULL column definition while the slimmer schema is DEFAULT NULL.
I also tested it with a 2.8.4 and there I have to explicitly use @JoinColumn(nullable=false) to make that column not nullable. The pure presence of the annotation does not change the schema.
I think that's not intended.
The text was updated successfully, but these errors were encountered:
I tested the new version and I still have strange behavior.
class A {
#[ORM\ManyToOne]
publicRegion$region; // DEFAULT NULL
#[ORM\ManyToOne]
#[ORM\JoinColumn]
publicRegion$region; // NOT NULL
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable=true)]
publicRegion$region; // NOT NULL
}
It seems like the type hint logic only runs when the join column definition exists.
If there is at least 1 indicator of nullable=false (be it php type hint or metadata) it always assumes nullable false.
What I would expect:
If the metadata specifies nullable, that should overrule everything else. There are some circular situations where it is necessary to have the relation nullable.
I'm still experimenting with the 2.9.x branch (6753b26) and noticed a strange schema difference.
These 2 definitions create a different schema. The
JoinColumn
definition creates aNOT NULL
column definition while the slimmer schema isDEFAULT NULL
.I also tested it with a
2.8.4
and there I have to explicitly use@JoinColumn(nullable=false)
to make that column not nullable. The pure presence of the annotation does not change the schema.I think that's not intended.
The text was updated successfully, but these errors were encountered: