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
There were "bugs" in ORM && Symfony related to typed properties in PHP 7.4 that required the properties to be nullable for doctrine.
What I do not know, is if we remove the ? from properties that are not nullable, will this cause any conflicts with earlier supported symfony / doctrine versions.
From a different issue (copy and pasted)
Doctrine & Symfony have fixed the bugs which did not allow to proxy a doctrine entity with uninitialized properties. See doctrine/orm#8030 & symfony/symfony#36332
If getLastName() is called before setLastName() is called, and/or before the entity is persisted to the database, then the value will be null regardless what the column definition says.
@seb-jean In your example, the getter should be nullable. See this case:
Yup, exactly right :).
One thing we DO need to do still is start adding property types to generated code. In this case, the property would be generated as private ?string $lastName;.
Hi,
I'm wondering whether to prefix the type name with a question mark when the property is not nullable on getter.
Here is an example of the code of the entity generated by the maker-bundle:
Shouldn't we generate the code below instead:
Thanks 😄
The text was updated successfully, but these errors were encountered: