This topic contains 3 replies, has 3 voices, and was last updated by msulima 6 years, 1 month ago.
- Topic
Hi,
I’m trying to add a custom filter to a custom field in Case Entity. I have extended the case bundle and did the following:
1) Created a new filter:
123456789101112131415161718192021222324252627282930313233343536namespace Custom\Bundle\CaseBundle\Filter;use Oro\Bundle\FilterBundle\Datasource\FilterDatasourceAdapterInterface;use Oro\Bundle\FilterBundle\Filter\ChoiceFilter;use Oro\Bundle\FilterBundle\Filter\FilterUtility;class GroupConcatMultipleFilter extends ChoiceFilter{/*** {@inheritdoc}*/public function apply(FilterDatasourceAdapterInterface $ds, $data){$data = $this->parseData($data);if (!$data) {return false;}$values = $data['value'];$parameterName = $ds->generateParameterName($this->getName());$exprOrX = $ds->getQueryBuilder()->expr()->orX();foreach ($values as $value) {$uniqueParameter = $parameterName.md5($value);$exprOrX->add($ds->expr()->like($this->get(FilterUtility::DATA_NAME_KEY), $uniqueParameter, true));$ds->setParameter($uniqueParameter, '%' . $value . '%');}$this->applyFilterToClause($ds,$exprOrX);return true;}}2) Registered in services.yml:
123456789101112parameters:custom_filter.group_concat_multiple_filter.class: Custom\Bundle\CaseBundle\Filter\GroupConcatMultipleFilterservices:custom_filter.group_concat_multiple_filter:class: %custom_filter.group_concat_multiple_filter.class%arguments:- @form.factory- @oro_filter.filter_utilitytags:- { name: oro_filter.extension.orm_filter.filter, type: group-concat-multiple }3) Created a js file for the filter (Custom/Bundle/CaseBundle/Resources/public/js/filter/group-concat-multiple-filter.js):
123456789101112131415161718192021define(['./group-concat-filter'], function(GroupConcatFilter) {'use strict';var GroupConcatMultipleFilter;GroupConcatMultipleFilter = GroupConcatFilter.extend({/*** Initialize.** @param {Object} options*/initialize: function(options) {GroupConcatMultipleFilter.__super__.initialize.apply(this, arguments);}});return GroupConcatMultipleFilter;});4) And lastly added to requirejs.yml:
123config:paths:'orofilter/js/group-concat-multiple-filter': 'bundles/customcase/js/filter/group-concat-multiple-filter.js'Then when I run the commands (as per here) I get an error:
1234567891011[RuntimeException]Tracing dependencies for: /var/www/html/crm/web/js/oro.min.jsError: ENOENT: no such file or directory, open '/var/www/html/crm/web/bundles/customcase/js/filter/group-concat-filter.js'In module tree:customcase/js/filter/group-concat-multiple-filterError: Error: ENOENT: no such file or directory, open '/var/www/html/crm/web/bundles/customcase/js/filter/group-concat-filter.js'In module tree:customcase/js/filter/group-concat-multiple-filterat Error (native)I tried different paths in requirejs but it didn’t help. Can someone please guide where I’m going wrong?
Thank you so much!
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.