定制 acseo/fast-show-generator-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

acseo/fast-show-generator-bundle

Composer 安装命令:

composer require acseo/fast-show-generator-bundle

包简介

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

README 文档

README

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

Version: 2.0 Compatibility: Symfony ^5.0 || ^6.0

Installation using Composer

$ 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 :

use ACSEO\FastShowGeneratorBundle\Annotations as ACSEOFastShowGeneratorBundle;

For each property :

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

In controller :

$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 :

#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 :

        $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 :

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

统计信息

  • 总下载量: 4.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 11
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-02-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固