-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Description
I'm the creator of issue #119.
And I have come further in my journey to get the functionality I want, expect I am running into a problem.
The problem being that a delimiter on a WhereIdIn isn't called when the filter is passed through a WhereHas filter.
Example url http://localhost/api/v1/companies?filter[sectors][id]=2,3 returns
Expecting filter value to be an array, or a string when a string delimiter is set.
When looking further into the code I have noticed the delimiter function isn't even called and the apply will call the deserialize and down the line toArray gets called before the delimiter is even set and will always result in this error.
SectorSchema filters
/**
* Get the resource filters.
*
* @return array
*/
public function filters(): array
{
return [
WhereIdIn::make($this)->delimiter(','),
FilterOnNullWhenZero::make('parent', 'parent_id')
];
}
CompanySchema filters.
/**
* Get the resource filters.
*
* @return array
*/
public function filters(): array
{
return [
WhereIdIn::make($this)->delimiter(','),
Where::make('company_type'),
Where::make('name'),
WhereHas::make($this, 'sectors'),
CompanyFilter::make('searchTerm'),
];
}
Metadata
Metadata
Assignees
Labels
No labels