-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from einorler/attribute_filter
Dynamic aggregate filter
- Loading branch information
Showing
13 changed files
with
1,166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the ONGR package. | ||
* | ||
* (c) NFQ Technologies UAB <info@nfq.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace ONGR\FilterManagerBundle\DependencyInjection\Filter; | ||
|
||
use Symfony\Component\DependencyInjection\Definition; | ||
|
||
/** | ||
* Factory for choice filter. | ||
*/ | ||
class DynamicAggregateFactory extends AbstractFilterFactory | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure(Definition $definition, array $configuration) | ||
{ | ||
parent::configure($definition, $configuration); | ||
|
||
$definition->addMethodCall('setField', [$configuration['field']]); | ||
$definition->addMethodCall('setNameField', [$configuration['name_field']]); | ||
|
||
if (isset($configuration['sort']) && count($configuration['sort']) > 0) { | ||
$definition->addMethodCall('setSortType', [$configuration['sort']]); | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getNamespace() | ||
{ | ||
return 'ONGR\FilterManagerBundle\Filter\Widget\Dynamic\DynamicAggregate'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() | ||
{ | ||
return 'dynamic_aggregate'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the ONGR package. | ||
* | ||
* (c) NFQ Technologies UAB <info@nfq.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace ONGR\FilterManagerBundle\Filter\ViewData; | ||
|
||
use ONGR\FilterManagerBundle\Filter\ViewData; | ||
|
||
/** | ||
* This class represents view data with aggregated choices. | ||
*/ | ||
class AggregateViewData extends ViewData | ||
{ | ||
/** | ||
* @var ChoicesAwareViewData[] | ||
*/ | ||
private $items; | ||
|
||
/** | ||
* @return ChoicesAwareViewData[] | ||
*/ | ||
public function getItems() | ||
{ | ||
return $this->items; | ||
} | ||
|
||
/** | ||
* @param array $items | ||
*/ | ||
public function setItems($items) | ||
{ | ||
$this->items = $items; | ||
} | ||
|
||
/** | ||
* @param ChoicesAwareViewData $item | ||
*/ | ||
public function addItem(ChoicesAwareViewData $item) | ||
{ | ||
$this->items[] = $item; | ||
} | ||
} |
Oops, something went wrong.