2017 © Pedro Peláez
 

symfony-bundle fast-show-generator-bundle

A bundle to quickly generate show actions based on annotation or yaml

image

acseo/fast-show-generator-bundle

A bundle to quickly generate show actions based on annotation or yaml

  • Friday, March 14, 2014
  • by nicolaskern
  • Repository
  • 11 Watchers
  • 0 Stars
  • 599 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 6 % Grown

The README.md

ACSEOFastShowGeneratorBundle

ACSEOFastShowGeneratorBundle allows to quickly generate show actions based on annotation or yaml This bundle was initiated by Nicolas Kern (ACSEO)., (*1)

Version: 2.0 Compatibility: Symfony ^5.0, Twig >= 1.5.0, (*2)

Installation using Composer

``` bash $ composer install acseo/fast-show-generator-bundle, (*3)


Composer will install the bundle to your project's `vendor/ACSEO` directory. ## How To Use #### Annotation In entity : ```php use ACSEO\FastShowGeneratorBundle\Annotations as ACSEOFastShowGeneratorBundle;

For each property :, (*4)

* @ACSEOFastShowGenerator\Show(label="My Property 1", show=true, groups={"default"})

In controller :, (*5)

$fastShow = $this->get('acseo_fast_show_generator.driver.annotation');

$fastShow->setEntity(new MyEntity());
$fastShow->setGroup('default');
$fastShow->setClassMetadata($em->getClassMetadata("ACSEOMyBundle:MyEntity"));

$fastShowData = $fastShow->getShowableData();

YAML :

Create the a file in your bundle for each entity :, (*6)

#ACSEO/Bundle/MyBundle/Resources/config/fastshowgenerator/MyEntity.default.fastshowgenerator.yml

ACSEO\Bundle\MyBundle\Entity\MyEntity:
    Columns:
        myProperty:
            label: My Property 1
            show: true
            groups: {"default"}
        myProperty2:
            label: My Property 2
            show: true
            groups: {"default"}

In controller :, (*7)

        $fastShow = $this->get('acseo_fast_show_generator.driver.yaml');

        $fastShow->setEntity($entity);
        $fastShow->setGroup('default');
        $fastShow->setClassMetadata($em->getClassMetadata($this->getEntityName()));

        $fastShowData = $fastShow->getShowableData();

Available options :

label : string - optional - if not set, uses the property name capitalized
show : boolean - optional - if not set, value is assumed to be true
groups : array - optional - if not set, group name is "default"

Template

Now, in your twig file, something like that :, (*8)

    <table class="table table-striped">
      <tbody>
        {% for propertyName, propertyValue in data %}
            <tr><td>{{ propertyName }}</td><td>{{ propertyValue }}</td></tr>
        {% endfor %}
      </tbody>
    </table>

The Versions

14/03 2014

dev-master

9999999-dev https://github.com/acseo/FastShowGeneratorBundle

A bundle to quickly generate show actions based on annotation or yaml

  Sources   Download

The Requires

 

by Nicolas Potier
by Nicolas Kern

symfony generate show

05/02 2014

dev-2.3-dev

dev-2.3-dev https://github.com/acseo/FastShowGeneratorBundle

A bundle to quickly generate show actions based on annotation or yaml

  Sources   Download

The Requires

 

by Nicolas Potier
by Nicolas Kern

symfony generate show