title: Getting Objects from database in Symfony2
body: <p>I had read somewhere some day that symfony2/Doctrine2 has a method(i don't remember the method name now) that fetches all "like" objects that we specify.. 
  For example, I have <code>User entity</code> that has <code>userName</code> , <code>password</code>, <code>name</code>, <code>state</code> and <code>city</code> as properties.. For getting all Users who has <code>name = "vinay"</code> and <code>state = "karnataka"</code>, the steps goes like this,,</p>
  
  <pre><code>$user = new User();
  $user-&gt;setName("vinay");
  $user-&gt;setState("karnataka");
  
  $query = $em-&gt;dontKnowTheMethod($user);
  $usersList = $query-&gt;getResult();
  </code></pre>
  
  <p><code>$usersList</code> should contain all the users whose <code>name = "vinay"</code> and <code>state = "karnataka"</code></p>
  
  <p>I searched for hours but Im not getting that method.. Im sure I had read about that method long back but I cannot recall now..</p>
  
  <p>Thanks in advance.. </p>