Active
Project:
Drupal core
Version:
main
Component:
database system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Jul 2018 at 17:41 UTC
Updated:
24 Oct 2019 at 14:20 UTC
Jump to comment: Most recent
In #2976334: Allow Custom blocks to be set as non-reusable adding access restriction based on where it was used. we had to put logic in to check if there was a condition 'reusable' so we didn't add a condition if there already one was one.
@wim leers and @larowlan both suggested it would be nice if there was API around this.
Add a method hasCondition() to \Drupal\Core\Database\Query\ConditionInterface
or find a better place this API.
Comments
Comment #2
daffie commentedIf you want to checks if a condition is empty you can also test on
empty($condition->__toString()).Would calling the method
isEmptyCondition()be a better name for what you want?Comment #6
geek-merlinImho this stems from the fact that the basic paradigm of this class is being a query builder, not a declarative abstraction.
That said, having this makes sense.
I'd prefer an API like this: