sasedev/hidden-entity-type-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sasedev/hidden-entity-type-bundle

Composer 安装命令:

composer require sasedev/hidden-entity-type-bundle

包简介

Hidden field for Symfony entities

README 文档

README

Hidden entity type for Symfony forms.

paypal

What is it?

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

Installation

Step 1: Download HiddenEntityTypeBundle using composer

$ composer require sasedev/hidden-entity-type-bundle

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

Step 2: Enable the bundle

Enable the bundle in the config if flex it did´nt do it for you:

<?php
// config/bundles.php

return [
    // ...
    Sasedev\HiddenEntityTypeBundle\SasedevHiddenEntityTypeBundle::class => ['all' => true],
    // ...
];

Usage

Simple usage:

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

<?php

use Sasedev\HiddenEntityTypeBundle\Form\Type\HiddenEntityType;

// ...
$builder->add('entity', HiddenEntityType::class, array(
    'class' => YourBundleEntity::class
));

You can also use the HiddenDocumentType::class type:

<?php

use Sasedev\HiddenEntityTypeBundle\Form\Type\HiddenDocumentType;

// ...
$builder->add('document', HiddenDocumentType::class, array(
    'class' => YourBundleDocument::class
));

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 HiddenEntityType or HiddenDocumentType type in your forms this way:

<?php
// ...
$builder->add('entity', HiddenEntityType::class, array(
    'class' => YourBundleEntity::class, // required
    'property' => 'entity_id', // Mapped property name (default is 'id'), not required
    'multiple' => false, // support for an array of entities, not required
    'data' => $entity, // Field value by default, not required
    'invalid_message' => 'The entity does not exist.', // Message that would be shown if no entity found, not required
));

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.

Copy

This is a modified copy of source from Shapecode (https://github.com/shapecode/hidden-entity-type-bundle) that support sf>=7.3.

Original

The orginal source is from Glifery (https://github.com/Glifery/EntityHiddenTypeBundle) but seems not to be supported anymore.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固