2017 © Pedro Peláez
 

symfony-bundle autocomplete-bundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

image

samson/autocomplete-bundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  • Friday, January 5, 2018
  • by SamsonIT
  • Repository
  • 14 Watchers
  • 8 Stars
  • 4,980 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 6 Open issues
  • 12 Versions
  • 3 % Grown

The README.md

README

Checkout SamsonIT/ShowCase to see a working example of how to use this bundle., (*1)

How to install

Currently, you'll need to follow these steps to ensure the autocomplete will work:, (*2)

  • Enable this and the UnexpectedResponseBundle in your AppKernel

Example: https://github.com/SamsonIT/ShowCase/blob/master/app/AppKernel.php#L22, (*3)

  • Make sure the latest JQuery version is loaded (JQuery UI is not necessary)
  • Make sure the latest Select2 javascript is loaded
  • Make sure the latest Select2 css files are loaded and that the images bundled with it are in place
  • Make sure the autocomplete.js file in this bundle is loaded
  • Make sure the autocomplete.css file in this bundle is loaded (this one is not all that necessary)

An example of the above requirements can be found in https://github.com/SamsonIT/ShowCase/blob/master/src/Samson/Bundle/ShowCaseBundle/Resources/views/Autocomplete/index.html.twig, (*4)

  • Make sure the autocomplete.html.twig form theme is included into twig

Find an example here: https://github.com/SamsonIT/ShowCase/blob/master/app/config/config.yml#L24, (*5)

How to use

Using the autocomplete is very simple. There are three required options to configure the Form type, and one recommended:, (*6)

$form = $this->createForm('autocomplete', null, array(
  'class' => 'SomeEntityClass',
  'template' => 'Template to use to display the entity.html.twig',
  'search_fields' => array('list of fields to search in'),
  'query_builder' => function(EntityRepository $er) {
    return $er->createQueryBuilder('s');
  }
);

The template can be defined as follows:, (*7)

{% if highlight %}
Found: {{ result.name|highlight }}
{% else %}
{{ result.name }}
{% endif %}

The highlight filter will simply do nothing if the highlight property is false, so this is also a valid template:, (*8)

{{ result.name|highlight }}

Upgrade

See Upgrade.md, (*9)

The Versions

05/01 2018

dev-master

9999999-dev https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

12/02 2015

2.0.3

2.0.3.0 https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

12/02 2015

dev-revert-17-patch-1

dev-revert-17-patch-1 https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

12/02 2015

2.0.2

2.0.2.0 https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

22/05 2014

2.0.1

2.0.1.0 https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

12/05 2014

2.0.0

2.0.0.0 https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

12/05 2014

1.1.1

1.1.1.0 https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

21/03 2014

1.1.0

1.1.0.0 https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

20/03 2014

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

20/03 2014

1.0.0

1.0.0.0 https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

20/01 2014

dev-phpcr-support

dev-phpcr-support https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete

22/08 2013

dev-dropdown-width

dev-dropdown-width https://github.com/SamsonIT/AutocompleteBundle

Easily integrate the Select2 autocomplete widget into your Symfony application to search Doctrine entities

  Sources   Download

MIT

The Requires

 

The Development Requires

orm doctrine symfony select2 autocomplete