You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
attaches the provided media identifier to the given tag(s)
My first guess would be that if you have multiple simultaneous requests modifying the same media and/or tags, you could potentially get a race condition where request A detaches the media, then request B attaches the media, then request A attempts to attach the media to the same tag. The most common approach to address this kind of problem is to wrap any such requests in a database transaction, which will hold write locks to any rows modified until the transaction is committed, preventing other requests from attempting to modify the same rows.
Im using syncMedia to replace a media attachment, however sometimes its causing a Integrity constraint violation: 1062 Duplicate entry error.
Code I'm using is:
if ($request->has('main_image')) { $product->syncMedia($request->input('main_image')['original']['id'], 'main_image'); }
The text was updated successfully, but these errors were encountered: