<?phpnamespace Knitink\ManagementBundle\Listener;use Knitink\ManagementBundle\Domain\GatewayManager;use Knitink\ManagementBundle\Domain\LicenseModuleManager;use Knitink\ManagementBundle\Domain\LicenseUnitManager;use Knitink\ManagementBundle\Domain\UnitManager;use Knitink\ManagementBundle\Entity\DBAL\StatusType;use Knitink\ManagementBundle\Entity\Historial;use Knitink\ManagementBundle\Event\TeamEvent;use Symfony\Component\EventDispatcher\EventSubscriberInterface;class TeamSubscriber implements EventSubscriberInterface{ public function __construct() { } /** * @inheritDoc */ public static function getSubscribedEvents() { return [ TeamEvent::CREATE_SUCCESS => 'onCreateSuccess', TeamEvent::CREATE_COMPLETED => 'onCreateCompleted', TeamEvent::EDIT_SUCCESS => 'onEditSuccess', TeamEvent::EDIT_COMPLETED => 'onEditCompleted' ]; } public function onCreateSuccess(TeamEvent $event) { $team = $event->getTeam(); $form = $event->getForm(); } public function onCreateCompleted(TeamEvent $event) { $team = $event->getTeam(); $form = $event->getForm(); /* $historial = new Historial(); $historial->setUnit($master); $historial->setTeam($master->getTeam()); $historial->setClient($master->getClient()); $historial->setDealer($master->getDealer()); $historial->setStatus(StatusType::ACTIVE); $historial->setDoneBy($this->getUser()); $historial->setMessage("STR_SUBSCRIBE_TEAM"); $em->persist($historial); */ /* $historial = new Historial(); $historial->setGateway($gateway); $historial->setTeam($gateway->getTeam()); $historial->setClient($gateway->getClient()); $historial->setDealer($gateway->getDealer()); $historial->setStatus(StatusType::ACTIVE); $historial->setDoneBy($this->getUser()); $historial->setMessage("STR_SUBSCRIBE_TEAM"); $em->persist($historial); */ } public function onEditSuccess(TeamEvent $event) { $form = $event->getForm(); } public function onEditCompleted(TeamEvent $event) { $team = $event->getTeam(); /* $stock = $dealer->getLicenseByItem($type); // Vemos si tienen licencias libres para ese tipo de Master if($stock == null || $stock->getFree() <= 0){ $object->setMaster(null); //$this->addFlash('error', 'STR_MASTER_CREATE_NO_PERMISSION'); //$tab = "edit"; }else { $stock->addUsed(); if($unitReadonly == false){ $historial = new Historial(); $historial->setUnit($master); $historial->setTeam($master->getTeam()); $historial->setClient($master->getClient()); $historial->setDealer($master->getDealer()); $historial->setStatus(StatusType::ACTIVE); $historial->setDoneBy($this->getUser()); $historial->setMessage("STR_SUBSCRIBE_TEAM"); $em->persist($historial); } */ /* if($gatewayReadonly == false) { $historial = new Historial(); $historial->setGateway($gateway); $historial->setTeam($gateway->getTeam()); $historial->setClient($gateway->getClient()); $historial->setDealer($gateway->getDealer()); $historial->setStatus(StatusType::ACTIVE); $historial->setDoneBy($this->getUser()); $historial->setMessage("STR_SUBSCRIBE_TEAM"); $em->persist($historial); } */ }}