public function operatorPromote(Query $query, TokenInterface $token)
    {
        $value = strtolower($token->value());
        $conjunction = $token->negated() ? '<>' : '';
        $conditions = [];

        if ($value === 'true') {
            $conditions = ["Contents.promote {$conjunction}" => 1];
        } elseif ($value === 'false') {
            $conditions = ['Contents.promote {$conjunction}' => 0];
        }

        if (!empty($conditions)) {
            if ($token->where() === 'or') {
                $query->orWhere($conditions);
            } elseif ($token->where() === 'and') {
                $query->andWhere($conditions);
            } else {
                $query->where($conditions);
            }
        }

        return $query;
    }
public function operatorPromote(Query $query, TokenInterface $token)
    {
        $value = strtolower($token->value());
        $conjunction = $token->negated() ? '<>' : '';
        $conditions = [];

        if ($value === 'true') {
            $conditions = ["Contents.promote {$conjunction}" => 1];
        } elseif ($value === 'false') {
            $conditions = ['Contents.promote {$conjunction}' => 0];
        }

        if (!empty($conditions)) {
            if ($token->where() === 'or') {
                $query->orWhere($conditions);
            } elseif ($token->where() === 'and') {
                $query->andWhere($conditions);
            } else {
                $query->where($conditions);
            }
        }

        return $query;
    }
public function operatorPromote ( Query $ query , TokenInterface $ token ) { $ value = strtolower ( $ token -> value ( ) ) ; $ conjunction = $ token -> negated ( ) ? '<>' : '' ; $ conditions = [ ] ; if ( $ value === 'true' ) { $ conditions = [ "Contents.promote {$conjunction}" => 1 ] ; } elseif ( $ value === 'false' ) { $ conditions = [ 'Contents.promote {$conjunction}' => 0 ] ; } if ( ! empty ( $ conditions ) ) { if ( $ token -> where ( ) === 'or' ) { $ query -> orWhere ( $ conditions ) ; } elseif ( $ token -> where ( ) === 'and' ) { $ query -> andWhere ( $ conditions ) ; } else { $ query -> where ( $ conditions ) ; } } return $ query ; }
Handles "promote" search operator.

promote:<true|false>

@param \Cake\ORM\Query $query The query object
@param \Search\Parser\TokenInterface $token Operator token
@return \Cake\ORM\Query
Handles promote search operator .