<?php
/*
* This file is part of the Globunet Project package.
*
* Created by Globunet on 10/04/16. <info@globunet.com>
* Copyright (c) 2015 Globunet Soluciones Tecnológicas, SL. All rights reserved.
*
*/
namespace Globunet\NotificationBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Doctrine\DBAL\Types\Type;
use Globunet\NotificationBundle\DependencyInjection\Compiler\AddHandlerPass;
class GlobunetNotificationBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new AddHandlerPass());
}
public function boot(){
$em = $this->container->get('doctrine.orm.entity_manager');
// Comprobar si ya se definieron los tipos
if (!Type::hasType("NOTIFICATION_TYPE")) {
Type::addType('NOTIFICATION_TYPE', 'Globunet\NotificationBundle\Entity\DBAL\EnumNotificationType');
$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('NOTIFICATION_TYPE','NOTIFICATION_TYPE');
}
if (!Type::hasType("NOTIFICATION_ACTION_TYPE")) {
Type::addType('NOTIFICATION_ACTION_TYPE', 'Globunet\NotificationBundle\Entity\DBAL\EnumNotificationActionType');
$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('NOTIFICATION_ACTION_TYPE','NOTIFICATION_ACTION_TYPE');
}
if (!Type::hasType("NOTIFICATION_STATE")) {
Type::addType('NOTIFICATION_STATE', 'Globunet\NotificationBundle\Entity\DBAL\EnumNotificationState');
$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('NOTIFICATION_STATE','NOTIFICATION_STATE');
}
if (!Type::hasType("PLATFORM_TYPE")) {
Type::addType('PLATFORM_TYPE', 'Globunet\NotificationBundle\Entity\DBAL\EnumPlatformType');
$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('PLATFORM_TYPE','PLATFORM_TYPE');
}
}
}