2017 © Pedro Peláez
 

symfony-bundle search-bundle

Symfony2 SearchBundle

image

padam87/search-bundle

Symfony2 SearchBundle

  • Wednesday, April 2, 2014
  • by Padam87
  • Repository
  • 2 Watchers
  • 8 Stars
  • 2,443 Installations
  • PHP
  • 1 Dependents
  • 2 Suggesters
  • 6 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Build Status Coverage Status Scrutinizer Quality Score SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Search Bundle

Search bundle for Symfony2. Use entities, collections for search directly. Great for handling complex search forms., (*2)

1. Examples

1.1 Simple

$fm = $this->get('padam87_search.filter.manager');
$filter = new Filter($data, 'YourBundle:Entity', 'alias');
$qb = $fm->createQueryBuilder($filter);

$data can be an array, an entity, or even a doctrine collection., (*3)

You can add your own converter to handle any type of data., (*4)

1.2 Joins

$fm = $this->get('padam87_search.filter.manager');
$filter1 = new Filter($data1, 'YourBundle:Entity1', 'alias1');
$filter2 = new Filter($data2, 'YourBundle:Entity2', 'alias2');
$qb = $fm->joinToQueryBuilder($filter2, $fm->createQueryBuilder($filter1), 'associationName');

'associationName' is the name of the relation in your entity, eg 'users', (*5)

1.3 Collection valued associations

$fm = $this->get('padam87_search.filter.manager');
$filter = new Filter($data, 'YourBundle:Entity', 'alias');
$qb = $fm->createQueryBuilder($filter);

When $data is an entity, it can have *ToMany associations. By default, the bundle assumes OR relationship between the elements of the collection. To change that, you can use the 2nd parameter of $fm->createQueryBuilder:, (*6)

$fm = $this->get('padam87_search.filter.manager');
$filter = new Filter($data, 'YourBundle:Entity', 'alias');
$qb = $fm->createQueryBuilder($filter, array(
    'relationName' => 'AND'
));

1.4 Operators

$data = array(
    'integerField>=' => 10
    'stringFiled' => 'A*'
);
$filter = new Filter($data, 'YourBundle:Entity', 'alias');

The bundle will search for operators in the field names and values, and use the appropriate Expr., (*7)

For a nicer, and entity-compatible solution you can use the 4th parameter of the Filter to set default operators:, (*8)

$filter = new Filter($data, 'YourBundle:Entity', 'alias', array(
    'integerField' => '>='
));

2. Installation

2.1. Composer

"padam87/search-bundle": "2.0.*",

2.2. AppKernel

$bundles = array(
    ...
    new Padam87\SearchBundle\Padam87SearchBundle(),
);

The Versions

02/04 2014

dev-master

9999999-dev https://github.com/Padam87/SearchBundle

Symfony2 SearchBundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Prager

search symfony

02/04 2014

v2.0.1

2.0.1.0 https://github.com/Padam87/SearchBundle

Symfony2 SearchBundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Prager

search symfony

22/03 2014

v2.0.0

2.0.0.0 https://github.com/Padam87/SearchBundle

Symfony2 SearchBundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adam Prager

search symfony

19/12 2013

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/Padam87/SearchBundle

Symfony2 SearchBundle

  Sources   Download

The Requires

 

The Development Requires

by Adam Prager

search symfony

08/12 2013

v1.0.2

1.0.2.0 https://github.com/Padam87/SearchBundle

Symfony2 SearchBundle

  Sources   Download

The Requires

 

The Development Requires

by Adam Prager

search symfony

06/12 2013

v1.0.1

1.0.1.0 https://github.com/Padam87/SearchBundle

Symfony2 SearchBundle

  Sources   Download

The Requires

 

The Development Requires

by Adam Prager

search symfony

28/11 2013

v1.0.0

1.0.0.0 https://github.com/Padam87/SearchBundle

Symfony2 SearchBundle

  Sources   Download

The Requires

 

The Development Requires

by Adam Prager

search symfony