Longstanding intermittent error with entity relationships

Your software
My Mautic version is: 4.4.9
My PHP version is: 8.0
My Database type and version is: MySQL

Your problem
My problem is:

We have been running Mautic (currently at 4.4.6) for a few years, handling all our marketing as well as transactional and system emails. Everything runs fairly smoothly, and we’ve been able to some useful customisation whenever needed. However, for about as long as I can remember, our logfiles have been polluted with the occasional error message (but seemingly becoming more often with increased traffic) , always regarding the same issue. As far as we can tell the functionality is not impacted by these errors, but honestly we cannot be sure. But it’s becoming more imperative now to find out the root cause of these messages and resolve them.

These errors are showing in the log:

mautic.ERROR: CAMPAIGN: A new entity was found through the relationship 'Mautic\CampaignBundle\Entity\LeadEventLog#lead' that was not configured to cascade persist operations for entity: Proxies\__CG__\Mautic\LeadBundle\Entity\Lead with ID #xxxxx. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}). [] {"hostname":"a627d6d25b20","pid":18345}

Steps I have tried to fix the problem:

I have looked at the lead_event_log table to see if indeed there are maybe orphan rows containing a lead_id that does not relate to an existing lead, but that’s not the case. The foreign key constraints between the leads and lead_event_log tables also appear to be correct. This is not the case of one errant row either since it appears for most if not all new leads being created.

I’m not very well-versed with Symfony (my only real exposure to is is within the context of Mautic), so I don’t know what the underlying cause for this can be or what the proper fix is.

TIA