The following issue was discovered during the development of #61:
A Stream is read or created at the very beginning
Attempting to insert duplicate Superchat causes the entity manager to be closed
A new entity manager manager is created
A non-duplicate Superchat is being inserted into the database with the Stream created at the very beginning
Since the Stream belongs to an entity manager that's closed, it's considered to be a new object
Persisting the Superchat makes doctrine complain that the Stream is not persisted, therefore crashing the app
Need to find a better way to INSERT IGNORE the superchats. Would like to avoid unnecessary reads from the database, but re-creating the entity manager is causing issues. Worst comes to worst, potential duplicates should only be encountered in the very first Rumble chat message, so we can check for duplicates at that point and not further down.
The following issue was discovered during the development of #61:
Need to find a better way to INSERT IGNORE the superchats. Would like to avoid unnecessary reads from the database, but re-creating the entity manager is causing issues. Worst comes to worst, potential duplicates should only be encountered in the very first Rumble chat message, so we can check for duplicates at that point and not further down.