You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-15Lines changed: 23 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,12 @@
1
-
[Note from project maintainer: June 17th 2019](https://github.com/tetranz/select2entity-bundle/issues/144)
2
-
3
1
select2entity-bundle
4
2
====================
5
3
6
4
## Introduction
7
5
8
6
This is a Symfony bundle which enables the popular [Select2](https://select2.github.io) component to be used as a drop-in replacement for a standard entity field on a Symfony form.
9
7
10
-
It works with Symfony 2, 3 and 4.
8
+
It works with Symfony 4 and 5. For Symfony 2 and 3, please use version or 2.x of the bundle.
9
+
For Select2 4.0 and above. For older versions, use version 1.x of the bundle (not compatible with Symfony 5).
11
10
12
11
The main feature that this bundle provides compared with the standard Symfony entity field (rendered with a html select) is that the list is retrieved via a remote ajax call. This means that the list can be of almost unlimited size. The only limitation is the performance of the database query or whatever that retrieves the data in the remote web service.
13
12
@@ -53,32 +52,32 @@ Alternatively, minified versions of select2.js and select2.css can be loaded fro
53
52
Note that this only works with Select2 version 4. If you are using Select2 version 3.X please use `"tetranz/select2entity-bundle": "1.*"` in `composer.json`
54
53
55
54
* Run `php composer.phar update tetranz/select2entity-bundle` in your project root.
56
-
* Update your project `app/AppKernel.php` file and add this bundle to the $bundles array:
55
+
* Update your project `config/bundles.php` file and add this bundle to the $bundles array:
57
56
58
57
```php
59
-
$bundles = array(
58
+
$bundles = [
60
59
// ...
61
-
new Tetranz\Select2EntityBundle\TetranzSelect2EntityBundle(),
On Symfony 4, use `@TetranzSelect2Entity/Form/fields.html.twig` instead of `TetranzSelect2EntityBundle:Form:fields.html.twig`
69
+
- '@TetranzSelect2Entity/Form/fields.html.twig'
70
+
74
71
* Load the Javascript on the page. The simplest way is to add the following to your layout file. Don't forget to run console assets:install. Alternatively, do something more sophisticated with Assetic.
The following is for Symfony 3. The latest version works on both Symfony 2 and Symfony 3 but see https://github.com/tetranz/select2entity-bundle/tree/v2.1 for Symfony 2 configuration and use.
80
+
The following is for Symfony 4. See https://github.com/tetranz/select2entity-bundle/tree/v2.1 for Symfony 2/3 configuration and use.
82
81
83
82
Select2Entity is simple to use. In the buildForm method of a form type class, specify `Select2EntityType::class` as the type where you would otherwise use `entity:class`.
@@ -138,18 +143,21 @@ The url of the remote query can be given by either of two ways: `remote_route` i
138
143
`remote_params` can be optionally specified to provide parameters. Alternatively, `remote_path` can be used to specify
139
144
the url directly.
140
145
141
-
The defaults can be changed in your app/config.yml file with the following format.
146
+
You may use `query_parameters` for when those remote_params have to be changeable dynamically. You may change them using $('#elem).data('query-parameters', { /* new params */ });
147
+
148
+
The defaults can be changed in your config/packages/tetranzselect2entity.yaml file with the following format.
0 commit comments