public function findSentByObject(User $sender, $objectSearch, $executeQuery = true)
    {
        $dql = "
            SELECT um, m, u
            FROM Claroline\MessageBundle\Entity\UserMessage um
            JOIN um.user u
            JOIN um.message m
            WHERE u.id = {$sender->getId()}
            AND um.isRemoved = false
            AND um.isSent = true
            AND UPPER(m.object) LIKE :search
            ORDER BY m.date DESC
        ";
        $query = $this->_em->createQuery($dql);
        $searchParameter = '%' . strtoupper($objectSearch) . '%';
        $query->setParameter('search', $searchParameter);

        return $executeQuery ? $query->getResult() : $query;
    }
public function findSentByObject(User $sender, $objectSearch, $executeQuery = true)
    {
        $dql = "
            SELECT um, m, u
            FROM Claroline\MessageBundle\Entity\UserMessage um
            JOIN um.user u
            JOIN um.message m
            WHERE u.id = {$sender->getId()}
            AND um.isRemoved = false
            AND um.isSent = true
            AND UPPER(m.object) LIKE :search
            ORDER BY m.date DESC
        ";
        $query = $this->_em->createQuery($dql);
        $searchParameter = '%' . strtoupper($objectSearch) . '%';
        $query->setParameter('search', $searchParameter);

        return $executeQuery ? $query->getResult() : $query;
    }
public function findSentByObject ( User $ sender , $ objectSearch , $ executeQuery = true ) { $ dql = "
            SELECT um, m, u
            FROM Claroline\MessageBundle\Entity\UserMessage um
            JOIN um.user u
            JOIN um.message m
            WHERE u.id = {$sender->getId()}
            AND um.isRemoved = false
            AND um.isSent = true
            AND UPPER(m.object) LIKE :search
            ORDER BY m.date DESC
        " ; $ query = $ this -> _em -> createQuery ( $ dql ) ; $ searchParameter = '%' . strtoupper ( $ objectSearch ) . '%' ; $ query -> setParameter ( 'search' , $ searchParameter ) ; return $ executeQuery ? $ query -> getResult ( ) : $ query ; }
Finds UserMessage sent by a user, filtered by a search on the object.

@param User $sender
@param string $objectSearch
@param boolean $executeQuery

@return array[UserMessage]|Query
Finds UserMessage sent by a user filtered by a search on the object .