-
-
Notifications
You must be signed in to change notification settings - Fork 221
Description
Version: v2.8.2
Bug Description
Hi, I haven't been able to create a minimal example of this problem, how to simulate this, so a general description must suffice.
When I load an entity from a Doctrine that contains a collection of other entities internally (such as a OneToMany session) and dump that collection (which has not yet fetched data), the dump function often loops and runs out of time, even if it contains the bare minimum of data.
If I increase the timeout to 10 minutes, for example, the dump function will run out after a few minutes, but I couldn't find out exactly where the problem is.
The problem happens to me across projects and I also solved it during the training, when other people asked me about it.
Steps To Reproduce
The minimal example that triggers an infinite loop looks like this:
/**
* @var ZakaznikKontaktEmail[]|Collection
* @ORM\OneToMany(targetEntity="ZakaznikKontakt", mappedBy="zakaznik")
*/
private $emails;
public function __construct()
{
$this->emails = new ArrayCollection;
}
/**
* @return ZakaznikKontaktEmail[]
*/
public function getEmails(): array
{
dump($this->emails); // <-- problem is here
return $this->emails->toArray();
}Expected Behavior
I tried to implement something like ttl that could stop recursion, but it didn't work. If you have a better idea, I will be very happy.
Thanks!
cc @matikara
