<?php
/**
 * Created by PhpStorm.
 * User: danielknudsen
 * Date: 11.04.18
 * Time: 18:56
 */

namespace App\EventListener;


use App\Entity\EntUser;
use App\Entity\IFace\IEntity;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;

class DatabaseListener implements EventSubscriber
{
    const ENVIRONMENT_DEV = "dev";

    /** @var TokenStorage $tokenStorage */
    private $tokenStorage;

    public function __construct(TokenStorage $tokenStorage, $environment)
    {
        $this->tokenStorage = $tokenStorage;
    }


    public function getSubscribedEvents()
    {
        return [
            'postPersist',
            'postUpdate'
        ];
    }

    /**
     * @param LifecycleEventArgs $args
     * @throws \Doctrine\ORM\ORMException
     * @throws \Doctrine\ORM\OptimisticLockException
     */
    public function postUpdate(LifecycleEventArgs $args)
    {

    }

    /**
     * @param LifecycleEventArgs $args
     * @throws \Doctrine\ORM\ORMException
     * @throws \Doctrine\ORM\OptimisticLockException
     */
    public function postPersist(LifecycleEventArgs $args)
    {

    }

    /**
     * Creates a log entry for deleted entity
     * @param LifecycleEventArgs $args
     * @throws \Doctrine\ORM\ORMException
     * @throws \Doctrine\ORM\OptimisticLockException
     */
    public function preRemove(LifecycleEventArgs $args)
    {

    }

}