Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acseo/fastshowgeneratorbundle
Fast tool to generate show view of an Entity based on Yml or Annotation parameters
https://github.com/acseo/fastshowgeneratorbundle
Last synced: about 2 months ago
JSON representation
Fast tool to generate show view of an Entity based on Yml or Annotation parameters
- Host: GitHub
- URL: https://github.com/acseo/fastshowgeneratorbundle
- Owner: acseo
- License: mit
- Created: 2014-02-05T13:22:51.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-07-03T16:22:15.000Z (over 1 year ago)
- Last Synced: 2024-07-10T17:49:08.854Z (6 months ago)
- Language: PHP
- Size: 11.7 KB
- Stars: 0
- Watchers: 13
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ACSEOFastShowGeneratorBundle
----------------------------ACSEOFastShowGeneratorBundle allows to quickly generate show actions based on annotation or yaml
This bundle was initiated by Nicolas Kern ([ACSEO](http://www.acseo-conseil.fr)).**Version**: 2.0
**Compatibility**: Symfony ^5.0, Twig >= 1.5.0## Installation using Composer
``` bash
$ composer install acseo/fast-show-generator-bundle
```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 :
```php
* @ACSEOFastShowGenerator\Show(label="My Property 1", show=true, groups={"default"})
```In controller :
```php
$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 :
```js
#ACSEO/Bundle/MyBundle/Resources/config/fastshowgenerator/MyEntity.default.fastshowgenerator.ymlACSEO\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 :
```php
$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 :
```html
{% for propertyName, propertyValue in data %}
{{ propertyName }}{{ propertyValue }}
{% endfor %}
```