PHP code example of ojezu / configurable-discrimination-bundle

1. Go to this page and download the library: Download ojezu/configurable-discrimination-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/ */

    

ojezu / configurable-discrimination-bundle example snippets


class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new OJezu\ConfigurableDiscriminationBundle\ConfigurableDiscriminationBundle(),
            // app bundles
            new Acme\TestBundle\ParentBundle(),
            new Acme\TestBundle\ChildABundle(),
            new Acme\TestBundle\ChildBBundle(),
        );
        return $bundles;
    }
}

#Acme/AcmeParent/Entity/AcmeParent.php

/**
 * (...)
 * @ORM\DiscriminatorMap({"base" = "AcmeParent"})
 */
class AcmeParent
{
    (...)
}

# service.yml
services:
    acme.acme_entity.acme_child_a:
        class: 'Acme\AcmeChildA\Entity\AcmeChildA'
        public: false
        tags:
            - name: ojezu.configurable_discrimination
              discriminator_value: 'acme_child_a'

# service.yml
services:
    acme.acme_entity.acme_child_b:
        class: 'Acme\AcmeChildB\Entity\AcmeChildB'
        public: false
        tags:
            - name: ojezu.configurable_discrimination
              discriminator_value: 'acme_child_b'