Relation Filters
Doesnt Has
Definition
Including Relations Fields
Filter::relation('comments', [FilterType::DOESNT_HAS])->includeRelationFields();
With Defining Sub Filters
Filter::relation('comments', [FilterType::DOESNT_HAS],
Filter::only(
Filter::field('content', [FilterType::LIKE])
)
);
Array/Object Structure
target
string
requiredvalue
array
value.*
array
Any other filter
Example
$filter = [
'type' => '$doesntHas',
'target' => 'comments',
'value' => [
[
'type' => '$like',
'target' => 'content',
'value' => 'boring',
]
]
];
$sql = Project::filter([$filter])->toRawSql();
SQL
select
*
from
"projects"
where
not exists (
select
*
from
"comments"
where
"projects"."id" = "comments"."project_id"
and "comments"."content" LIKE '%boring%'
)
Modifiers
None available.