PHP code example of paneedesign / discriminator-map-bundle

1. Go to this page and download the library: Download paneedesign/discriminator-map-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/ */

    

paneedesign / discriminator-map-bundle example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new \PaneeDesign\DiscriminatorMapBundle\PedDiscriminatorMapBundle(),
        );

        // ...
    }

    // ...
}

/**
 * @ORM\Entity()
 * @ORM\Table(name="user")
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="user_grant", type="string", length="10")
 * @ORM\DiscriminatorMap({"user" = "User"})
 */
abstract class User
{
    ...
}

/**
 * Class Admin
 *
 * @package AppBundle\Entity
 * @ORM\Entity
 * @ORM\Table(name="user_admin")
 */
class Admin extends User
{
    ...
}

/**
 * Class Owner
 *
 * @package AppBundle\Entity
 * @ORM\Entity()
 * @ORM\Table(name="user_owner")
 */
class Owner
{
    ...
}

/**
 * Class Customer
 *
 * @package AppBundle\Entity
 * @ORM\Entity()
 * @ORM\Table(name="user_customer")
 */
class Customer
{
    ...
}