I've created a new service in my project. This service is configured in XML. I'd like to user the EntityManager, to retreive som data in the service but I'm not able to «connect» Doctrine to my service. Currently, I have this code:
services.xml
<service id="SiteService.search" class="Site\ProductBundle\Search\SphinxSearch" factory-service="doctrine.orm.entity_manager" factory-method="getRepository">
<argument>Site\ProductBundle\Entity\Product</argument>
</service>
SphinxSearch.php
namespace Dada\FilmsBundle\Search;
use Symfony\Component\DependencyInjection\ContainerAware;
class DadaSearch extends ContainerAware{
//Some stuff
public function fullNoPrivateByTitle($query){
//Call $this->getResultsFromId($idlist);
}
private function getResultsFromId($idlist){
$doctrine = $this->container->get('doctrine')->getManager()->getRepository('SiteProductBundle:Product');
//Rest of the method
}
With this code, I got a strange error. Seems like Symfony think my service is a sort of new Doctrine:
Undefined method 'fullNoPrivateByTitle'. The method name must start with either findBy or findOneBy! 500 Internal Server Error - BadMethodCallException
Can somebody help me with the configuration of my service? Thanks a lot.