How to use a custom repository in Symfony?
<p>I have a custom repository in my Symfony's project and I want use like a search tool. My project' structure is the following:</p>

<p><strong>P.D. UPDATED Question and code</strong></p>

<pre><code>-Manager:
 * BaseManager.php
 * MyEntityManager.php
-Repository:
 * BaseRepository.php
 * MyEntityRepository.php
</code></pre>

<p>Well, I want access to my custom repository and use the following method <code>findByTitle</code>, which method should return an array with objects which description field be similar. I put a simple print (var_dump of the term entered) inside of my function to see if my browser shows it, but it isn't showed yet...</p>

<p>My BaseManager:</p>

<pre><code>&lt;?php
namespace AppBundle\Manager;

use AppBundle\Repository\BaseRepository;

class BaseManager
{
    /**
     * @var BaseRepository
     */
    protected $repo;


    /**
     * @param BaseRepository $repo
     */
    public function __construct(BaseRepository $repo)
    {
        $this-&gt;repo = $repo;
    }

    /**
     * @param  $model
     * @return bool
     */
    public function create($model)
    {
        return $this-&gt;repo-&gt;create($model);
    }

    /**
     * @param CrudModel $model
     * @return bool
     */
    public function update($model)
    {
        return $this-&gt;repo-&gt;save($model);
    }

    /**
     * @param CrudModel $model
     * @return bool
     */
    public function delete($model)
    {
        return $this-&gt;repo-&gt;delete($model);
    }

    /**
     * @param $id
     * @return null|object
     */
    public function getOneById($id)
    {
        return $this-&gt;repo-&gt;findOneById($id);
    }

    /**
     * @return array
     */
    public function all()
    {
        return $this-&gt;repo-&gt;all();
    }

}
</code></pre>

<p>MyEntityManager:</p>

<pre><code>&lt;?php
namespace AppBundle\Manager;

use AppBundle\Repository\MyEntityRepository;
use AppBundle\Entity\MyEntity;

/**
 * Class MyEntityManager
 * @package AppBundle\Manager
 */
class MyEntityManager extends BaseManager{

    public function findByTitle($title){

        echo '&lt;h1&gt;flux of code here&lt;/h1&gt;';
        return $this-&gt;repo-&gt;findByTitle($title);
    }

    public function findSimilars($term){
        echo '&lt;h1&gt;flux of code here&lt;/h1&gt;';
        return $this-&gt;repo-&gt;findSimilars($term);
    }
}
</code></pre>

<p>BaseRepository:</p>

<pre><code>&lt;?php
namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;

abstract class BaseRepository extends EntityRepository
{
    public function create($model, $autoFlush = true)
    {
        return $this-&gt;insert($model,$autoFlush);
    }

    public function save($model, $autoFlush = true)
    {
        return $this-&gt;insert($model,$autoFlush);
    }

    public function delete($model)
    {
        try{
            $this-&gt;getEntityManager()-&gt;remove($model);
            $this-&gt;getEntityManager()-&gt;flush();
            return true;
        }catch (\Exception $e){
            echo $e-&gt;getMessage();
        }
    }

    public function findOneById($id)
    {
        return $this-&gt;findOneBy(array('id' =&gt; $id));
    }

    public function all()
    {
        return $this-&gt;findAll();
    }

    private function insert($model, $autoFlush = true)
    {
        $this-&gt;getEntityManager()-&gt;persist($model);
        if ($autoFlush) {
            $this-&gt;getEntityManager()-&gt;flush();
            return true;
        }
    }
}
</code></pre>

<p>MyEntityRepository:</p>

<pre><code>&lt;?php

namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
* Class MyEntityRepository
* @package AppBundle\Repository
*/
class MyEntityRepository extends BaseRepository{

  private function findById($id){
    $query = $this-&gt;createQueryBuilder('myentity')
    -&gt;where('myentity.id = :id')
    -&gt;setParameter('id', $id)
    -&gt;getQuery();

    $myentity = $query-&gt;getResult();

    return $myentity;
  }

  private function findByTitle($term){
      echo '&lt;h1&gt;';
      var_dump($term);
      echo '&lt;/h1&gt;',
      $query = $this-&gt;createQueryBuilder('myentity')
              -&gt;andwhere('myentity.description = :description')
              -&gt;setParameter('description', $term)
              -&gt;getQuery();
      $myentity = $query-&gt;getResult();

      return $myentity;
  }
}
</code></pre>

<p>The beginning of MyEntity:</p>

<pre><code>&lt;?php
namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;


/**
* @ORM\Table(name="myentity")
* @ORM\Entity
* @ORM\Entity(repositoryClass="AppBundle\Repository\MyEntityRepository")
*/
class MyEntity {

......
</code></pre>

<p>My services.yml:</p>

<pre><code>parameters:
    app.myentity.repository.class: AppBundle\Repository\MyEntityRepository
    app.myentity.manager.class: AppBundle\Manager\MyEntityManager

services:

    app.myentity.repository:
        class: %app.myentity.repository.class%
        public: true
        factory_service: doctrine.orm.entity_manager
        factory_method: getRepository
        arguments: [ AppBundle\Entity\MyEntity ]

    app.myentity.manager:
        class: %app.myentity.manager.class%
        arguments: [@app.myentity.repository]
</code></pre>

<p>And I'm calling my service in the following way:</p>

<pre><code> public function searchAction(Request $request, $term){
        $manager = $this-&gt;get('app.myentity.manager');
        $result = $manager-&gt;findByTitle($term);

        echo '&lt;h5&gt;';
        var_dump($result);
        echo '&lt;/h5&gt;';
        ....
    }
</code></pre>