I have class like this which works and returns feedbacks from the database
namespace Acme\Bundle\AcmeBundle\Handler;
use Doctrine\Common\Persistence\ManagerRegistry;
class FeedbackHandler implements FeedbackHandlerInterface
{
private $em;
private $entityClass;
private $repository;
public function __construct(ManagerRegistry $mr, $entityClass)
{
$this->em = $mr->getManager();
$this->entityClass = $entityClass;
$this->repository = $this->em->getRepository($this->entityClass);
}
public function get($id)
{
return $this->repository->find($id);
}
public function all($limit = 50, $offset = 0)
{
$feedbacks = $this->em->createQuery("SELECT f FROM AcmeAcmeBundle:Feedback f")
->setFirstResult($offset)
->setMaxResults($limit)
->getResult();
return array( "feedback" => $feedbacks );
}
}
however when I submit code to scrutinizer-ci.com it reports that
The method createQuery() does not seem to exist on object
same with PhpStorm, it displays warning at this line. Is there an approach to fix this issue?