Developed with love by KnpLabs Hire us for your project!
30

hidden-entity-type-bundle

by shapecode

Hidden entity type for Symfony forms.

Shapecode - Hidden Entity Type Bundle

Hidden entity type for Symfony forms.

paypal

PHP Version
Latest Stable Version
Latest Unstable Version
Total Downloads
Monthly Downloads
Daily Downloads
License

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 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
<?php
// config/bundles.php

return [
// ...
Shapecode\Bundle\HiddenEntityTypeBundle\ShapecodeHiddenEntityTypeBundle::class => ['all' => true],
// ...
];
```

Usage

Simple usage:

You can use the type in your forms just like this:
```php
<?php

use Shapecode\Bundle\HiddenEntityTypeBundle\Form\Type\HiddenEntityType;

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

You can also use the `HiddenDocumentType::class` type:
php
<?php

use Shapecode\Bundle\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
<?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.

Original

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

  • Merge remote-tracking branch 'origin/master'
    By nicklog, 1 month ago
  • update dependencies
    By nicklog, 1 month ago
  • Github sponsors
    By web-flow, 2 months ago
  • unit fix
    By nicklog, 6 months ago
  • cs fix
    By nicklog, 6 months ago
  • phpstan fixes
    By nicklog, 6 months ago
  • cs fix
    By nicklog, 6 months ago
  • composer unused fix
    By nicklog, 6 months ago
  • update coding standard
    By nicklog, 6 months ago
  • configure workflow
    By nicklog, 6 months ago
  • Merge pull request #6 from Joachim1985/master
    By web-flow, 6 months ago
  • added support for doctrine-bundle 2.0
    By joachim, 6 months ago
  • symf 5
    By nicklog, 8 months ago
  • php 7.4
    By nicklog, 9 months ago
  • fix
    By nicklog, 9 months ago
  • stan fix
    By nicklog, 9 months ago
  • tests
    By nicklog, 9 months ago
  • test cases
    By nicklog, 9 months ago
  • cs fix
    By nicklog, 9 months ago
  • code quality tools
    By nicklog, 9 months ago
  • docker env
    By nicklog, 9 months ago
  • Create FUNDING.yml
    By web-flow, 9 months ago
  • Merge branch 'release/3.0'
    By nicklog, 1 year ago
  • fix
    By nicklog, 1 year ago
  • badges
    By nicklog, 1 year ago
  • typo
    By nicklog, 1 year ago
  • nicer
    By nicklog, 1 year ago
  • remove donate btn
    By nicklog, 1 year ago
  • dev mail
    By nicklog, 1 year ago
  • increase required php version
    By nicklog, 1 year ago