Comments (11)
Hi, for the filter_choice
it's a forgetting from us, maybe we should check if the value we get is a collection or a single value. But the option should work with the filter_entity
except if the relation is a many-to-many, in this case you will have to override the filter by using the apply_filter options
from lexikformfilterbundle.
@cedric-g : it doesn't seems to work with filter_entity :
Catchable Fatal Error: Argument 1 passed to My\Entity\Class::getProperty() must be an instance of My\Entity\Class, instance of Doctrine\Common\Collections\ArrayCollection given, called in PropertyAccessor.php on line 438
Form code:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('property', 'filter_entity', array(
'class' => 'MyBundle:MyEntity',
'expanded' => TRUE,
'multiple' => TRUE,
));
}
from lexikformfilterbundle.
That is what Cedric said with its previous comment. You can make use of the 'apply_filter' option, look at the link for an example.
You should iterate over the results, in order to add it to the QueryBuilder
from lexikformfilterbundle.
@rvanlaak @cedric-g : I'm sorry but I have read the doc several times and I have absolutely no clue of what I should do with apply_filter
option to fix this.
from lexikformfilterbundle.
@gaetan-petit do you use a data_class
in your type ?
If yes I suppose the field on which you use filter_entity
is a single relation, but when you set multiple
to true
this mean the type will handle a collection (this is the behavior of the entity
type). So when the form is submitted and it try to call setProperty() it will pass a collection instead of a single entity.
Just don't defined any data_class
and it should work.
from lexikformfilterbundle.
@cedric-g Thanks for the answer but something is still wrong.
When multiple option are selected the query is not correct, and returns no results:
AND t1_.status_id IN ('43,44,45')
Instead of:
AND t1_.status_id IN (43,44,45)
I'am trying to spot where is the faulty code, but I bet you will be faster than me 😉
from lexikformfilterbundle.
@gaetan-petit Which version of the bundle are you using ?
from lexikformfilterbundle.
@cedric-g : I'm on master with in my config.yml
lexik_form_filter:
where_method: and
from lexikformfilterbundle.
I pushed a little change on master
, can you try and check if it's ok ?
from lexikformfilterbundle.
@cedric-g Ha, I was just about to submit the same change in a PR 😛
It works like a charm with the change, thank you 😄
from lexikformfilterbundle.
1+
fixed with 49ed731
from lexikformfilterbundle.
Related Issues (20)
- Mongo as separate packages? HOT 2
- v5.0.9 Broken with symfony 3.4 HOT 2
- Service "lexik_form_filter.query_builder_updater" not found HOT 4
- doctrine/orm v2.6.4 has issues with using ChoiceFilterType with objects
- NumberRangeFilterType can not set attribute " type:'number' '' , and 'label' is not work as well HOT 3
- CollectionAdapterFilterType display an unwanted "level" with a label : "0" HOT 2
- Store Entity in session HOT 1
- Not a issue, change repo description HOT 1
- How to have more user/search engines friendly urls
- Works in symfony 5.1 ? HOT 1
- How to add a field to set maxresults HOT 1
- Options 'data' does not work for EntityFilterType
- Hi HOT 3
- Undefined class constant 'INTEGER' when filtering EntityFilterType HOT 2
- doctrine/orm to specific HOT 1
- Using ChoiceFilterType generate: Undefined constant Doctrine\DBAL\Types\Type::STRING HOT 1
- Ltrim issue in LexikFormFilterBundle/Event/Subscriber/DoctrineORMSubscriber.php
- Filter by entity with string id HOT 3
- Feature Request: Allow using array based $parameters with IN() expressions HOT 2
- Bundle abandonned...and moved on new organization!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lexikformfilterbundle.