<?php
/**
 * Created by PhpStorm.
 * User: Arthur Touzard
 * Date: 24/04/2018
 * Time: 10:37
 */

namespace AppBundle\Service;

use AppBundle\Entity\Historique;
use Doctrine\ORM\EntityManagerInterface;

class LogService
{
    private $em;

    /**
     * LogService constructor.
     * @param $em
     */
    public function __construct(EntityManagerInterface $em)
    {
        $this->em = $em;
    }

    public function logHistoNow($type, $entity, $msg, $user)
    {
        $histo = new Historique($type, $entity, $msg, $user);
        $this->em->persist($histo);
        $this->em->flush($histo);
    }

}