I am currently building a Symfony 4.4 API that is capable of adding objects to a database. Since I believe that my problem can be explained and resolved using only theory I won't add my actual code here but I'll provide a more conceptual description.
I have an entity class named Person
. This class has a corresponding form, called PersonType
. A person could have a user and an employee linked to it. These also have their entities and forms.
A user has a field called createdBy
which links to another user and an employee must have a person linked to it.
My problem is that when I try to patch a person using the usual way (createForm()
and Doctrine, like here), I get a memory overflow at createForm()
. When I remove the references to UserType
and EmployeeType
from PersonType
, there is no memory overflow. My memory size is 1GB, and I believe making it larger will not resolve the issue.
Is there is a way to limit the number of circular references, or to prevent the rendering of the person of the employee of the person, for example.