PHP code example of benkle / doctrine-adoption-bundle

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

    

benkle / doctrine-adoption-bundle example snippets



// app/AppKernel.php

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

            new Benkle\DoctrineAdoptionBundle\BenkleDoctrineAdoptionBundle(),
        );

        // ...
    }

    // ...
}

/**
 * Class Document
 * @package AppBundle\Entity
 * @Entity()
 * @Table(name="documents")
 * @InheritanceType("JOINED")
 * @DiscriminatorColumn(name="type", type="string")
 * @DiscriminatorMap({"document" = "AppBundle\Entity\Document"})
 */
class Document
{
    /**
     * @Id()
     * @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    public $id;

    /**
     * @Column(type="string")
     */
    public $name;
}

/**
 * Class TextDocument
 * @package Demo\TextDocumentBundle\Entity
 * @Entity()
 * @Table(name="text_documents")
 */
class TextDocument extends Document
{
    /**
     * @Column(type="text")
     */
    public $text;
}