定制 glifery/entity-hidden-type-bundle 二次开发

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

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

glifery/entity-hidden-type-bundle

最新稳定版本:2.1.0

Composer 安装命令:

composer require glifery/entity-hidden-type-bundle

包简介

Hidden field for Symfony2 entities

README 文档

README

Hidden entity type for Symfony2/Symfony3 forms.

What is it?

This is a Symfony2/Symfony3 form type that allows you to add an entity in your form that would be displayed as a hidden input.

Installation

Step 1: Download EntityHiddenTypeBundle using composer

$ php composer.phar require glifery/entity-hidden-type-bundle

Composer will install the bundle to your project's vendor/glifery directory.

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Glifery\EntityHiddenTypeBundle\GliferyEntityHiddenTypeBundle(),
        // ...
    );
}

Usage

Simple usage:

You can use the EntityHiddenType::class type in your forms just like this:

<?php
    // ...
    $builder->add('entity', EntityHiddenType::class, array(
        'class' => 'YourBundle:Entity' // That's all !
    ));

You can also use the DocumentHiddenType::class type:

<?php
    // ...
    $builder->add('document', DocumentHiddenType::class, array(
        'class' => 'YourBundle:Document' // That's all !
    ));

There is only one required option "class". You must specify entity class in Symfony format that you want to be used in your form.

Advanced usage:

You can use the EntityHiddenType::class or DocumentHiddenType::class type in your forms this way:

<?php
    // ...
    $builder->add('entity', EntityHiddenType::class, array(
        'class' => 'YourBundle:Entity'
        'property' => 'entity_id', // Mapped property name (default is 'id')
        'data' => $entity, // Field value by default
        'multiple' => true, // You can pass collection of 'YourBundle:Entity' instead of single entity
        'invalid_message' => 'The entity does not exist.', // Message that would be shown if no entity found
        'em' => 'common_em' // You can use specified entity manager for use with entity_hidden
        'dm' => 'common_dm' // You can use specified document manager for use with document_hidden
    ));

Reporting an issue or a feature request

Feel free to report any issues. If you have an idea to make it better go ahead and modify and submit pull requests.

统计信息

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

GitHub 信息

  • Stars: 18
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-13