PHP Symfony's best choice for disable movie

70 Views Asked by At

here is the repo: https://github.com/webostin/sf-case-study/tree/master/movie-invalidator

Short App description

Platform Symfony. We have Movie Entity. We have complex caching system for cache movies pagination and movies itself. We have frontend panel and backend panel. We have User Entity attached to Movie. We have also Admin Entity.

Problem

We need to soft delete Movie and at the same time reset cache and send email. We have to make it in three (or in future more) contexts:

  1. Frontend User deletes Movie attached to him. Action: soft remove, reset cache, send email to admin;
  2. Admin deletes Movie. Action: soft remove, cache restart, send email to User.
  3. Cron while checking Movie data disables the movie. Action: soft remove, reset cache, send emails to Admin and User

Question

What is the best practise in this specific example. I found 3 solutions: implement everying separetly (not good), write an event subscriber and trigger an event whenever I want to disable Movie, write a service and use Service to disable Movie. It's question for best readable and proper solution. Please provide your solutions if you have any

1

There are 1 best solutions below

1
On

Mark to delete the movie in the first step. In this case you do not need to unload the cache (you will see a warning message in the interface). In the second step, the administrator confirms the deletion and is added to the queue for cron. the third step is to delete the cron, send e-mail and clear the cache. In this way the entire load rides on the cron.