CakePHP
  • 文档
    • 书籍
    • API
    • 视频
    • 报告安全问题
    • 隐私政策
    • 徽标和商标
  • 商业解决方案
  • 纪念品
  • 公路旅行
  • 团队
  • 社区
    • 社区
    • 参与其中
    • 问题 (Github)
    • 面包店
    • 精选资源
    • 培训
    • 聚会
    • 我的 CakePHP
    • CakeFest
    • 时事通讯
    • 领英
    • YouTube
    • 脸书
    • 推特
    • Mastodon
    • 帮助和支持
    • 论坛
    • Stack Overflow
    • IRC
    • Slack
    • 付费支持
CakePHP

C CakePHP 5.1 Chiffon API

  • 项目
    • CakePHP
      • CakePHP
      • Chronos
      • Elastic Search
      • 队列
  • 版本
    • 5.1
      • 5.1
      • 5.0
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

命名空间

  • 全局
  • Cake
    • 缓存
    • 集合
    • 命令
    • 控制台
    • 控制器
    • 核心
    • 数据库
      • 驱动程序
      • 异常
      • 表达式
      • 日志
      • 查询
      • 重试
      • 模式
      • 语句
      • 类型
    • 数据源
    • 错误
    • 事件
    • 表单
    • Http
    • I18n
    • 日志
    • 邮件器
    • 网络
    • ORM
    • 路由
    • 测试套件
    • 实用程序
    • 验证
    • 视图

类 TupleComparison

此表达式表示用于比较一个元组与另一个元组、一个元组与一组其他元组或一个元组与一个表达式的 SQL 片段。

命名空间: Cake\Database\Expression

属性摘要

  • $_field 受保护
    Cake\Database\ExpressionInterface|array|string

    要在运算符左侧使用的字段名称或表达式。

  • $_isMultiple 受保护
    bool

    此表达式中的值是否可遍历。

  • $_operator 受保护
    string

    用于比较字段和值的运算符。

  • $_type 受保护
    string|null

    用于将值转换为数据库表示的类型。

  • $_value 受保护
    mixed

    要在运算符右侧使用的值。

  • $_valueExpressions 受保护
    arrayCake\Database\ExpressionInterface>

    此表达式中值中找到的 ExpressionInterface 对象的缓存列表。

  • $types 受保护
    array<string|null>

    用于将值转换为数据库表示的类型。

方法摘要

  • __clone() 公开

    创建深度克隆。

  • __construct() 公开

    构造函数

  • _bindValue() 受保护

    在占位符生成器中注册一个值并返回生成的占位符

  • _castToExpression() 受保护

    如果类型类实现了 ExpressionTypeInterface,则有条件地将传递的值转换为 ExpressionInterface 对象。否则,返回未修改的值。

  • _collectExpressions() 受保护

    返回一个数组,第一个位置是原始 $values,第二个位置是所有可以在其中找到的 ExpressionInterface 对象。

  • _flattenValue() 受保护

    将可遍历值转换为由 $binder 生成的占位符集,并以 , 分隔。

  • _requiresToExpressionCasting() 受保护

    返回一个数组,其中包含从参数传递的类型名称列表中需要将值转换为表达式的类型。

  • _stringExpression() 受保护

    在使用占位符 $binder 注册值后,返回一个模板和一个占位符。

  • _stringifyValues() 受保护

    返回一个字符串,其中值作为占位符位于字符串中,用于此表达式的 SQL 版本。

  • _traverseValue() 受保护

    如果传递的值是 ExpressionInterface,则有条件地为传递的值执行回调。

  • getField() 公开

    返回字段名称。

  • getOperator() 公开

    返回用于比较的运算符。

  • getType() 公开

    返回用于将值转换为数据库表示的类型。

  • getValue() 公开

    返回用于比较的值。

  • isMulti() 公开

    确定此表达式中的每个值本身是否都是一个元组。

  • setField() 公开

    设置字段名称。

  • setOperator() 公开

    设置用于比较的运算符。

  • setValue() 公开

    设置值。

  • sql() 公开

    将节点转换为 SQL 字符串片段。

  • traverse() 公开

    递归地迭代表达式的每个部分,针对表达式树的每一层,并执行回调,并将当前正在迭代的表达式的实例作为第一个参数传递。

方法详细信息

__clone() ¶ 公开

__clone(): void

创建深度克隆。

克隆字段和值(如果它们是表达式对象)。

返回值
void

__construct() ¶ 公开

__construct(Cake\Database\ExpressionInterface|array|string $fields, Cake\Database\ExpressionInterface|array $values, array<string|null> $types = [], string $conjunction = '=')

构造函数

参数
Cake\Database\ExpressionInterface|array|string $fields

用于形成元组的字段。

Cake\Database\ExpressionInterface|array $values

用于形成元组的值。

array<string|null> $types 可选

用于将每个值转换为类型的类型名称,每个值数组中的位置只需要一个类型。

string $conjunction 可选

用于比较字段和值的运算符。

_bindValue() ¶ 受保护

_bindValue(mixed $value, Cake\Database\ValueBinder $binder, string|null $type = null): string

在占位符生成器中注册一个值并返回生成的占位符

参数
mixed $value
Cake\Database\ValueBinder $binder
string|null $type 可选
返回值
string

_castToExpression() ¶ 受保护

_castToExpression(mixed $value, string|null $type = null): mixed

如果类型类实现了 ExpressionTypeInterface,则有条件地将传递的值转换为 ExpressionInterface 对象。否则,返回未修改的值。

参数
mixed $value

要转换为 ExpressionInterface 的值。

string|null $type 可选

类型名称。

返回值
mixed

_collectExpressions() ¶ 受保护

_collectExpressions(Cake\Database\ExpressionInterface|iterable $values): array

返回一个数组,第一个位置是原始 $values,第二个位置是所有可以在其中找到的 ExpressionInterface 对象。

参数
Cake\Database\ExpressionInterface|iterable $values

要插入的行。

返回值
array

_flattenValue() ¶ 受保护

_flattenValue(iterable $value, Cake\Database\ValueBinder $binder, string|null $type = null): string

将可遍历值转换为由 $binder 生成的占位符集,并以 , 分隔。

参数
iterable $value

要展平的值。

Cake\Database\ValueBinder $binder

要使用的值绑定器。

string|null $type 可选

要将值转换为的类型。

返回值
string

_requiresToExpressionCasting() ¶ 受保护

_requiresToExpressionCasting(array $types): array

返回一个数组,其中包含从参数传递的类型名称列表中需要将值转换为表达式的类型。

参数
array $types

类型名称列表。

返回值
array

_stringExpression() ¶ 受保护

_stringExpression(Cake\Database\ValueBinder $binder): array

在使用占位符 $binder 注册值后,返回一个模板和一个占位符。

参数
Cake\Database\ValueBinder $binder

要使用的值绑定器。

返回值
array

_stringifyValues() ¶ 受保护

_stringifyValues(Cake\Database\ValueBinder $binder): string

返回一个字符串,其中值作为占位符位于字符串中,用于此表达式的 SQL 版本。

参数
Cake\Database\ValueBinder $binder

要使用表达式转换的值绑定器。

返回值
string

_traverseValue() ¶ 受保护

_traverseValue(mixed $value, Closure $callback): void

如果传递的值是 ExpressionInterface,则有条件地为传递的值执行回调。

参数
mixed $value

要遍历的值。

Closure $callback

遍历时要使用的回调。

返回值
void

getField() ¶ 公开

getField(): Cake\Database\ExpressionInterface|array|string

返回字段名称。

返回值
Cake\Database\ExpressionInterface|array|string

getOperator() ¶ 公开

getOperator(): string

返回用于比较的运算符。

返回值
string

getType() ¶ 公开

getType(): array<string|null>

返回用于将值转换为数据库表示的类型。

返回值
array<string|null>

getValue() ¶ 公开

getValue(): mixed

返回用于比较的值。

返回值
mixed

isMulti() ¶ 公开

isMulti(): bool

确定此表达式中的每个值本身是否都是一个元组。

返回值
bool

setField() ¶ 公开

setField(Cake\Database\ExpressionInterface|array|string $field): void

设置字段名称。

参数
Cake\Database\ExpressionInterface|array|string $field

要比较的字段。

返回值
void

setOperator() ¶ 公开

setOperator(string $operator): void

设置用于比较的运算符。

参数
string $operator

用于比较的操作符。

返回值
void

setValue() ¶ public

setValue(mixed $value): void

设置值。

参数
mixed $value

要比较的值

返回值
void

sql() ¶ public

sql(Cake\Database\ValueBinder $binder): string

将节点转换为 SQL 字符串片段。

参数
Cake\Database\ValueBinder $binder
返回值
string

traverse() ¶ public

traverse(Closure $callback): $this

递归地迭代表达式的每个部分,针对表达式树的每一层,并执行回调,并将当前正在迭代的表达式的实例作为第一个参数传递。

参数
Closure $callback
返回值
$this

属性详情

$_field ¶ protected

要在运算符左侧使用的字段名称或表达式。

类型
Cake\Database\ExpressionInterface|array|string

$_isMultiple ¶ protected

此表达式中的值是否可遍历。

类型
bool

$_operator ¶ protected

用于比较字段和值的运算符。

类型
string

$_type ¶ protected

用于将值转换为数据库表示的类型。

类型
string|null

$_value ¶ protected

要在运算符右侧使用的值。

类型
mixed

$_valueExpressions ¶ protected

此表达式中值中找到的 ExpressionInterface 对象的缓存列表。

类型
arrayCake\Database\ExpressionInterface>

$types ¶ protected

用于将值转换为数据库表示的类型。

类型
array<string|null>
OpenHub
Pingping
Linode
  • 商业解决方案
  • 展示
  • 文档
  • 书籍
  • API
  • 视频
  • 报告安全问题
  • 隐私政策
  • 徽标和商标
  • 社区
  • 参与其中
  • 问题 (Github)
  • 面包店
  • 精选资源
  • 培训
  • 聚会
  • 我的 CakePHP
  • CakeFest
  • 时事通讯
  • 领英
  • YouTube
  • 脸书
  • 推特
  • Mastodon
  • 帮助和支持
  • 论坛
  • Stack Overflow
  • IRC
  • Slack
  • 付费支持

使用 CakePHP API 文档 生成