<?php 
 
 
namespace App\Form\Subscriber; 
 
 
use Doctrine\ORM\EntityManagerInterface; 
use Symfony\Component\EventDispatcher\EventSubscriberInterface; 
use Symfony\Component\Form\FormEvent; 
use Symfony\Component\Form\FormEvents; 
 
class VehicleSubscriber implements EventSubscriberInterface 
{ 
    /** 
     * @var EntityManagerInterface 
     */ 
    private $em; 
 
    /** 
     * Constructor. 
     * 
     * @param \Doctrine\ORM\EntityManagerInterface $manager 
     */ 
    public function __construct(EntityManagerInterface $manager) 
    { 
        $this->em = $manager; 
    } 
 
    public static function getSubscribedEvents() 
    { 
        return [FormEvents::POST_SUBMIT => 'onPostSubmit']; 
    } 
 
    /** 
     * Populate hourly cost according to selected vehicle 
     * 
     * @param \Symfony\Component\Form\FormEvent $event 
     * 
     * @throws \Doctrine\ORM\NonUniqueResultException 
     */ 
    public function onPostSubmit(FormEvent $event) 
    { 
        $data = $event->getData(); 
//        dump($data); 
    } 
}