title: Database Searching Using Doctrine and Symfony2
body: <p>So I'm currently trying to perform a simple search using Symfony2 and Doctrine. Something similar to this: <a href="http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/searching.html" rel="nofollow">http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/searching.html</a></p>
  
  <p>I've currently got the following <code>YAML</code> file setup to generate my entities. It generates my <code>class Style</code> entity correctly as a class.</p>
  
  <pre><code>...\Style:
      type: entity
      table: styles
      id:
          id:
              type: integer
              generator:
                  strategy: IDENTITY
      actAs:
          Searchable:
              fields: [title]
              batchUpdates: true
      fields:
          title:
              type: string
              length: 150
              unique: true
  </code></pre>
  
  <p>In my controller, I'm trying to run a search on that table based on a string.</p>
  
  <pre><code>public function searchAction($pattern) 
  {
      $repository = $this-&gt;getDoctrine()-&gt;getRepository('..:Style');
      $search = $repository-&gt;search($pattern);
  
      return $this-&gt;outputize($search);
  }
  </code></pre>
  
  <p>However, when I try executing the code, I get the following exception.</p>
  
  <pre><code>Undefined method 'search'. The method name must start with either findBy or findOneBy!
  </code></pre>
  
  <p>Am I generating my entities correctly or is there something I'm clearly missing?</p>
  
  <p>On a side note, when I look at my <code>Entity/Style.php</code> after generating, there is no clear method <code>-&gt;search()</code>, is the function supposed to be generated by Symfony here?</p>