<?php
/**
 * Bundle Definition
 *
 * @author Visual Media
 */

namespace VisualM\TagManagerBundle;

use Doctrine\DBAL\Types\Type;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use VisualM\TagManagerBundle\DependencyInjection\Compiler\TaggableManagerCompilerPass;

/**
 * Bundle Definition
 *
 * @author Visual Media
 */
class VisualMTagManagerBundle extends Bundle
{
    /**
     * {@inheritdoc}
     */
    public function boot()
    {
        if (!Type::hasType('meta_type')) {
            Type::addType('meta_type', 'VisualM\\TagManagerBundle\\Doctrine\\FieldType\\MetaType');
        }
        if (!Type::hasType('wijzigbaar_type')) {
            Type::addType('wijzigbaar_type', 'VisualM\\TagManagerBundle\\Doctrine\\FieldType\\WijzigbaarType');
        }
    }

    /**
     * {@inheritdoc}
     */
    public function build(ContainerBuilder $container)
    {
        parent::build($container);
        $container->addCompilerPass(new TaggableManagerCompilerPass());
    }
}
