Skip to content
Advertisement

Symfony 5 – ManyToOne __isInitialized__: false

I try to get value from object but objects return __isInitialized__: false and null values

what did I miss?

twig situ dump :

JavaScript

situ entity :

JavaScript

event entity :

JavaScript

category entity :

JavaScript

Advertisement

Answer

You just got to know the doctrine lazy loading feature. It fetches the data until you fired the getter method the first time. You could know this because you see the “Proxy-Entities” with allowes doctrine to archive the lazy load behavior. To change this you can edit the fetch behavior in your entities. For example this would activate it for the event property. Please note the ",fetch="EAGER"" part which is modified.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement