Hi i am getting this error while i am calling a custom function defined inside my repository class in Symfony
Code In Repo Class
class TaskRepository extends DocumentRepository
{
public function searchByFirstLetter($letter)
{
$query = $this->getDocumentManager()
->createQuery('SELECT u FROM WorkStackTaskBundle:Users u WHERE u.name LIKE :name')
->setParameter('name', $letter.'%');
try {
return $query->getResult();
} catch (\Doctrine\ODM\NoResultException $e) {
return null;
}}
Code In Controller $getasllusers = dm->getRepository('WorkStackTaskBundle:Users')->searchByFirstLetter($_GET['keyword']);
But i am getting following error.
Undefined method 'searchByFirstLetter'. The method name must start with either findBy or findOneBy! strong text Please suggest what might be wrong.
Thanks Advance