$ composer show sonata-project/*
sonata-project/admin-bundle 3.3.2 The missing Symfony Admin Ge...
sonata-project/block-bundle 3.0.1 Symfony SonataBlockBundle
sonata-project/cache 1.0.7 Cache library
sonata-project/core-bundle 3.0.3 Symfony SonataCoreBundle
sonata-project/doctrine-orm-admin-bundle 3.0.4 Symfony Sonata / Integrate D...
sonata-project/exporter 1.5.0 Lightweight Exporter library
$ composer show symfony/*
symfony/assetic-bundle v2.8.0 Integrates Assetic into Symfony2
symfony/monolog-bundle 2.11.1 Symfony MonologBundle
symfony/phpunit-bridge v3.1.1 Symfony PHPUnit Bridge
symfony/polyfill-apcu v1.2.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu v1.2.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.2.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.2.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.2.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.2.0 Symfony utilities for portability of PHP codes
symfony/security-acl v3.0.0 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony v3.1.1 The Symfony PHP framework
$ php -v
PHP 7.0.8-3+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
with blackfire v1.10.4, https://blackfire.io, by Blackfireio Inc.
I was thinking about have a option to choose between and/or the chosen fields to filter, could be a option under advanced filters.
I hope it doesn't already exists, I couldn't find anything in docs and issues.
Looks like there is something, at least for doctrine ORM : https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/3.x/Filter/Filter.php#L62
Yes there is! I was looking in the code, autocomplete uses the setCondition. Basically need to add a select field to choose between "and" and "or", or a check box to set "or". But I don't know anything about other storage options, just ORM.
BTW, we try to keep Github issues for bug reports and feature requests only. If you have a question, please ask it on Stack Overflow.
I'm closing this, but if you find how to do it, making a PR for a cookbook article would be great!
That's not a feature request? Add a option under advanced filters to choose "or" condition? But ok, I'm looking into code and I'll try to override some classes to do what I want.
Oh right I forgot, my bad.
Just a little test: I've added an admin extension with:
public function configureDatagridFilters(\Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper) {
$datagrid = $datagridMapper->getAdmin()->getDatagrid();
/* @var $filter \Sonata\AdminBundle\Filter\Filter */
foreach ($datagrid->getFilters() as $filter){
$filter->setCondition(\Sonata\AdminBundle\Filter\FilterInterface::CONDITION_OR);
}
}
And it worked.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Most helpful comment
Just a little test: I've added an admin extension with:
And it worked.