sanderdekroon /
parlant
| 1 | <?php |
||||||||
| 2 | |||||||||
| 3 | namespace Sanderdekroon\Parlant\Builder; |
||||||||
| 4 | |||||||||
| 5 | use Closure; |
||||||||
| 6 | use InvalidArgumentException; |
||||||||
| 7 | |||||||||
| 8 | trait QueriesTaxonomies |
||||||||
| 9 | { |
||||||||
| 10 | 4 | public function whereTaxonomy($taxonomy, $field = null, $operator = null, $value = null, $includeChildren = true, $relation = null, $level = 1) |
|||||||
| 11 | { |
||||||||
| 12 | 4 | $clause = new WhereTaxonomyClause($this->getGrammar()); |
|||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||||
| 13 | |||||||||
| 14 | 4 | foreach ($clause->build($taxonomy, $field, $operator, $value, $includeChildren, $relation, $level) as $where) { |
|||||||
| 15 | 4 | $this->appendBinding('whereTaxonomies', $where); |
|||||||
|
0 ignored issues
–
show
It seems like
appendBinding() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 16 | } |
||||||||
| 17 | |||||||||
| 18 | 4 | $this->setBinding('whereTaxonomyRelation', $clause->getRelation() + ($this->getBinding('whereTaxonomyRelation') ?: [1 => 'AND'])); |
|||||||
|
0 ignored issues
–
show
It seems like
setBinding() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
It seems like
getBinding() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 19 | |||||||||
| 20 | 4 | return $this; |
|||||||
| 21 | } |
||||||||
| 22 | |||||||||
| 23 | /** |
||||||||
| 24 | * Query the meta values (custom post fields) of posts and set the relation to OR |
||||||||
| 25 | * @param string $taxonomy The field name |
||||||||
| 26 | * @param string $operator |
||||||||
| 27 | * @param mixed $value |
||||||||
| 28 | * @param string $type The type comparison, for example NUMERIC or CHAR |
||||||||
| 29 | * @param integer $level The query level, currently unimplemented |
||||||||
| 30 | * @return $this |
||||||||
| 31 | */ |
||||||||
| 32 | 1 | public function orWhereTaxonomy($taxonomy, $field = null, $operator = null, $value = null, $includeChildren = true, $level = 1) |
|||||||
| 33 | { |
||||||||
| 34 | 1 | return $this->whereTaxonomy($taxonomy, $field, $operator, $value, $includeChildren, 'OR', $level); |
|||||||
| 35 | } |
||||||||
| 36 | } |
||||||||
| 37 |