<?php
/**
 * Created by PhpStorm.
 * User: m.dauphin
 * Date: 21/10/2021
 * Time: 15:25
 */

namespace App\Services;

use App\Entity\Tchat;
use Doctrine\ORM\EntityManagerInterface;

class TchatManagement {

    private $em;
    public function __construct(EntityManagerInterface $em) {
        $this->em = $em;
        // use the constructor to inject your dependencies, as usual
    }

    public function getMessages() {
        // do your thing
        return $this->em->getRepository(Tchat::class)->findAll();
    }
}