PHP code example of enterprisephp / display-bundle

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

    

enterprisephp / display-bundle example snippets



// app/AppKernel.php

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

            new EP\DisplayBundle\EPDisplayBundle(),
        );

        // ...
    }

    // ...
}


namespace AppBundle\Entity;

use EP\DisplayBundle\Entity\DisplayTrait;

class MyEntity
{
    use DisplayTrait;
}

namespace AppBundle\Entity;

use EP\DisplayBundle\Annotation as Display;

/**
 * @Display\Display(
 *     image_render=false, # optinal
 *     file_render=false, # optinal
 *     template="my_entity_special_template.html.twig", # optinal
 *     array_collection_render=true, # optinal
 *     collection_item_count=8, # optinal
 * )
 */
class MyEntity
{

namespace AppBundle\Entity;

use EP\DisplayBundle\Annotation as Display;

class DummyEntity
{
  /**
   * @Display\Exclude
   */
  protected $unPublicfieldForOnlyThisEntity;

namespace AppBundle\Entity;

use EP\DisplayBundle\Annotation as Display;

class DummyEntity
{
  /**
   * @Display\Expose
   */
  protected $oneTimeExposeField;

namespace AppBundle\Entity;

use EP\DisplayBundle\Annotation as Display;

class DummyEntity
{
  /**
   * @Display\File(path="uploads/files")
   */
  protected $mainFile;

namespace AppBundle\Entity;

use EP\DisplayBundle\Annotation as Display;

class DummyEntity
{
  /**
   * @Display\Image(
   *    path="uploads/files",
   *    height="50",
   *    width="70",
   * )
   */
  protected $cover;