PHP code example of wucdbm / entity-extend-bundle

1. Go to this page and download the library: Download wucdbm/entity-extend-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/ */

    

wucdbm / entity-extend-bundle example snippets


// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new \Pj\EntityExtendBundle\PjEntityExtendBundle(),
        // ...
    );
}



namespace Acme\ProductBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Class BaseProduct.
 *
 * @ORM\Entity
 * @ORM\Table(name="products")
 */
class BaseProduct
{
    /**
     * @var int
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string
     * @ORM\Column(type="string", length=100)
     */
    protected $name;

    /**
     * Getter for name.
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Setter for name.
     *
     * @param string $name
     *
     * @return $this
     */
    public function setName($name)
    {
        $this->name = $name;
        
        return $this;
    }
}



namespace Custom\ProductBundle\Entity;

use Acme\ProductBundle\Entity\Product as BaseProduct;
use Doctrine\ORM\Mapping as ORM;

/**
 * Class CustomProduct.
 *
 * @ORM\Entity
 */
class CustomProduct extends BaseProduct
{
    /**
     * @var string
     * @ORM\Column(type="string", nullable=true)
     */
    protected $description;
    
    /**
     * Getter for description.
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Setter for description.
     *
     * @param string $description
     *
     * @return $this
     */
    public function setDescription($description)
    {
        $this->description = $description;
        
        return $this;
    }
}