-3

Does an auto delete functionality is available to delete row(s) from a specific table when a condition is met?

Note: I'm using Symfony 3.3

Else if such a method doesn't exist,is there a dql alternative even for a static method(it doesn't have to be automatic,what i mean is a button click would trigger the action in the controller)?? Example: I have an entity named Deal and i want to auto delete any instance of 'Deal' in my Database that has passed the delay which is expressed in variable number of days.

  • Possible duplicate of [How do I delete an entity from symfony2](https://stackoverflow.com/questions/11809685/how-do-i-delete-an-entity-from-symfony2) – goto Feb 16 '18 at 10:42
  • Please provide more information about the condition. Is it another entity being deleted? Then you should look into dabase and ORM level cascades. Is it a business event? Then look into Doctrine and/or Symfony events. – lxg Feb 16 '18 at 15:50

1 Answers1

0

There is not, but if as part of your domain logic you need to perform automatic deletes, maybe you should look into EventListeners or Subscribers with Symfony Event Dispatcher component, so that actions may be performed when an event is fired in your system. You can easily inject the entity manager to one of those, and place your logic there.