User will send a message for example
user1 = "Show football score today plz"
user2 = "Show basketball score yesterday lol"
the key is "score"
I want to query that word form all sentence by use this two function
function like()
and function concat()
in the same time
I want that code something like this
LIKE CONCAT('%', message, '%')
LIKE CONCAT('Show football ', score,' today plz')
and this is my code
class MatchingMessageRepository extends EntityRepository
{
public function findByReceiveMessage($message)
{
$queryBuilder = $this->createQueryBuilder('o')
->where(parent::expr()->like('o.message', ':message'))
->setParameter('message', '%' . $message . '%')
->orderBy('o.message', 'ASC')
;
return $queryBuilder->getQuery()->getResult();
}
}
Can someone help me with this?