Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shapecode/hidden-entity-type-bundle
Hidden entity type for Symfony forms.
https://github.com/shapecode/hidden-entity-type-bundle
entity hidden symfony type
Last synced: about 1 month ago
JSON representation
Hidden entity type for Symfony forms.
- Host: GitHub
- URL: https://github.com/shapecode/hidden-entity-type-bundle
- Owner: shapecode
- Created: 2016-07-17T15:11:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-02T14:41:11.000Z (about 1 year ago)
- Last Synced: 2024-12-07T08:33:26.100Z (about 2 months ago)
- Topics: entity, hidden, symfony, type
- Language: PHP
- Homepage:
- Size: 133 KB
- Stars: 27
- Watchers: 3
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Shapecode - Hidden Entity Type Bundle
Hidden entity type for Symfony forms.
[![paypal](https://img.shields.io/badge/Donate-Paypal-blue.svg)](http://paypal.me/nloges)
[![PHP Version](https://img.shields.io/packagist/php-v/shapecode/hidden-entity-type-bundle.svg)](https://packagist.org/packages/shapecode/hidden-entity-type-bundle)
[![Latest Stable Version](https://img.shields.io/packagist/v/shapecode/hidden-entity-type-bundle.svg?label=stable)](https://packagist.org/packages/shapecode/hidden-entity-type-bundle)
[![Latest Unstable Version](https://img.shields.io/packagist/vpre/shapecode/hidden-entity-type-bundle.svg?label=unstable)](https://packagist.org/packages/shapecode/hidden-entity-type-bundle)
[![Total Downloads](https://img.shields.io/packagist/dt/shapecode/hidden-entity-type-bundle.svg)](https://packagist.org/packages/shapecode/hidden-entity-type-bundle)
[![Monthly Downloads](https://img.shields.io/packagist/dm/shapecode/hidden-entity-type-bundle.svg)](https://packagist.org/packages/shapecode/hidden-entity-type-bundle)
[![Daily Downloads](https://img.shields.io/packagist/dd/shapecode/hidden-entity-type-bundle.svg)](https://packagist.org/packages/shapecode/hidden-entity-type-bundle)
[![License](https://img.shields.io/packagist/l/shapecode/hidden-entity-type-bundle.svg)](https://packagist.org/packages/shapecode/hidden-entity-type-bundle)## 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
```bash
$ composer require shapecode/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
['all' => true],
// ...
];
```## Usage
### Simple usage:
You can use the type in your forms just like this:
```php
add('entity', HiddenEntityType::class, array(
'class' => YourBundleEntity::class
));
```
You can also use the `HiddenDocumentType::class` type:
```php
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
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.### Original
The orginal source is from Glifery (https://github.com/Glifery/EntityHiddenTypeBundle) but seems not to be supported anymore.