Documentation

Like extends AbstractPredicate
in package

Like predicate class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
7.0.0

Table of Contents

Properties

$conjunction  : string
Conjunction
$format  : string|null
Format
$values  : mixed
Values

Methods

__construct()  : mixed
Constructor
getConjunction()  : string
Get the conjunction
getFormat()  : string
Get the format
getValues()  : mixed
Get the values
render()  : string
Render the predicate string
setConjunction()  : AbstractPredicate
Get the conjunction
setValues()  : AbstractPredicate
Set values
assertNoSubqueryAlias()  : void
Assert that a nested Sql instance used as a subquery value has no alias set.
renderJsonValue()  : string
Render a JSON path comparison value
renderValue()  : string
Render a single predicate value: a nested Select/Sql instance embeds as a parenthesized subquery, anything else quotes as a literal/placeholder as before

Properties

Methods

__construct()

Constructor

public __construct(array<string|int, mixed> $values[, string $conjunction = 'AND' ]) : mixed

Instantiate the LIKE predicate set object

Parameters
$values : array<string|int, mixed>
$conjunction : string = 'AND'
Tags
throws
Exception

getConjunction()

Get the conjunction

public getConjunction() : string
Return values
string

assertNoSubqueryAlias()

Assert that a nested Sql instance used as a subquery value has no alias set.

protected static assertNoSubqueryAlias(AbstractSql $value) : void

An aliased Select renders itself as "(SELECT ...) AS alias", which is only valid in a FROM/JOIN context. Embedded inside a predicate it would produce silently invalid SQL, so reject it up front with a clear error.

Parameters
$value : AbstractSql
Tags
throws
Exception

renderJsonValue()

Render a JSON path comparison value

protected static renderJsonValue(AbstractSql $sql, string|null $column, mixed $value) : string

PostgreSQL's JSON extraction operators ('->>' / '#>>') always return text, and PostgreSQL has no implicit text-to-number comparison: a bare numeric literal on the right-hand side fails at execution time with "operator does not exist: text = integer". So on PostgreSQL a plain scalar value is forced to a quoted text literal, which compares correctly against the extracted text. Two cases must NOT be force-quoted and are handed to renderValue() unchanged: a nested Sql instance (which embeds as a parenthesized subquery), and a bound parameter placeholder token (which the database binds as text anyway).

Parameters
$sql : AbstractSql
$column : string|null
$value : mixed
Tags
throws
Exception
Return values
string

renderValue()

Render a single predicate value: a nested Select/Sql instance embeds as a parenthesized subquery, anything else quotes as a literal/placeholder as before

protected static renderValue(AbstractSql $sql, mixed $value) : string
Parameters
$sql : AbstractSql
$value : mixed
Tags
throws
Exception
Return values
string

        
On this page

Search results