Your IP : 216.73.217.79


Current Path : /var/www/v3.cesa.co.za/src/ContactBundle/Repository/
Upload File :
Current File : /var/www/v3.cesa.co.za/src/ContactBundle/Repository/MessageAttachmentRepository.php

<?php

namespace App\ContactBundle\Repository;

use App\ContactBundle\Entity\MessageAttachment;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
 * MessageAttachment Repository
 *
 * @author Otto Saayman <otto@igotafrica.com>
 * @package ContactBundle
 * @subpackage Repository
 * @version 0.0.1
 */
class MessageAttachmentRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, MessageAttachment::class);
    }

    /**
     * Find attachments by message
     *
     * @param int $messageId
     * @return array
     */
    public function findByMessage(int $messageId): array
    {
        return $this->createQueryBuilder('ma')
            ->where('ma.message = :messageId')
            ->setParameter('messageId', $messageId)
            ->orderBy('ma.id', 'ASC')
            ->getQuery()
            ->getResult();
    }
}