PHP code example of levelab / doctrine-discriminator-bundle

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

    

levelab / doctrine-discriminator-bundle example snippets


use Levelab\Doctrine\DiscriminatorBundle\Annotation\DiscriminatorParent
use Levelab\Doctrine\DiscriminatorBundle\Annotation\DiscriminatorEntry

/**
 * @DiscriminatorMap({"self" = "Parent", "child1" = "Child1", "child2" = "Child2"})
 */
class Parent { }

class Child1 extends Parent {}

class Child2 extends Parent {}

/**
 * @DiscriminatorParent()
 * @DiscriminatorEntry("self")
 */
class Parent { }

/**
 * @DiscriminatorEntry("child1")
 */
class Child1 extends Parent {}

/**
 * @DiscriminatorEntry("child2")
 */
class Child2 extends Parent {}