PHP code example of ubc / ltcommons-bundle

1. Go to this page and download the library: Download ubc/ltcommons-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ubc / ltcommons-bundle example snippets


// app/AppKernel.php

class AppKernel extends Kernel
{
    // ...

    public function registerBundles()
    {
        $bundles = array(
            // ...,
            new UBC\LtCommonsBundle\LtCommonsBundle(),
        );

        // ...
    }
}



use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

// Bootstrap the JMS custom annotations for Object to Json mapping
\Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
    'JMS\Serializer\Annotation',
    dirname(__FILE__).'/vendor/jms/serializer/src'
);

$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
$container->registerExtension(new \UBC\LtCommons\UBCLtCommonsExtension());

$loader = new YamlFileLoader($container, new FileLocator(__DIR__));
$loader->load('config.yml');

$container->compile();

$codes = $container->get('ubc_lt_commons.service.department_code')->getDepartmentCodes();