title: How exactly do I create a custom EntityManager in Symfony2/Doctrine?
body: <p>New guy at Symfony/Doctrine. So kindly guide me. </p>
  
  <p>Requirement: To create a custom EntityManager which would override some of the methods like remove (instead of remove, i want to perform an update and modify a parameter like isValid in my class, so that the records are never deleted) and a find ( find a record which has a non zero isValid ) etc and use it instead of Doctrine's EntityManager.</p>
  
  <p>I started reading through this thread:
  <a href="https://stackoverflow.com/questions/8138962/is-there-a-way-to-specify-doctrine2-entitymanager-implementation-class-in-symfon">Is there a way to specify Doctrine2 Entitymanager implementation class in Symfony2?</a> and found the answer by user2563451 to be not so straightforward. I got lost when he talks about not to follow certain approaches (again no location of the files to be modified). </p>
  
  <p>I have looked at the EntityManager.php and it specifically tells not to use extend the EntityManager class. Rather it asks to extend the EntityManagerDecorator. On looking at the EntityManagerDecorator, there are no methods available inside it (like create, persist, etc which I found in EntityManager) Does it mean I need to create new methods for each and every single Entity Manager functionality ?</p>
  
  <p>Since there is no clear defined way to get this done, I am confused to get this thing started. Also Doctrine cookbook is of little use to me as it does not have any information to achieve this.</p>
  
  <p>So any help regarding the extending of EntityManagerDecorator or EntityManager is appreciated. </p>
  
  <p>Best if you can provide me step by step directions to achieve the same.</p>
  
  <p>Thanks !</p>
  
  <p>Edit 1: my requirement is to use my custom EntityManager instead of Doctrine's EntityManager (EM) and modify those 'remove' and 'find' methods as per my requirements. I am not sure whether I need to reuse the functionality provided by Doctrine's EM or write from scratch.</p>