CakePHP
  • 文档
    • 书籍
    • API
    • 视频
    • 报告安全问题
    • 隐私政策
    • 标识和商标
  • 商业解决方案
  • 周边商品
  • 公路旅行
  • 团队
  • 社区
    • 社区
    • 参与进来
    • 问题 (Github)
    • 面包店
    • 精选资源
    • 培训
    • 聚会
    • 我的 CakePHP
    • CakeFest
    • 通讯
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • 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
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
      • Association
      • Behavior
      • Exception
      • Locator
      • Query
      • Rule
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

类 ExistsIn

检查提供的字段值是否作为另一个表的 主键 存在。

命名空间: Cake\ORM\Rule

属性摘要

  • $_fields protected
    list<string>

    要检查的字段列表

  • $_options protected
    array<string, mixed>

    构造函数选项

  • $_repository protected
    Cake\ORM\TableCake\ORM\Association|string

    将要查找字段的存储库,或存储库的关联名称。

方法摘要

  • __construct() public

    构造函数。

  • __invoke() public

    执行存在性检查

  • _fieldsAreNull() protected

    检查给定实体字段是否可为空且为空。

方法详情

__construct() ¶ public

__construct(list<string>|string $fields, Cake\ORM\TableCake\ORM\Association|string $repository, array<string, mixed> $options = [])

构造函数。

$options 中的可用选项是 'allowNullableNulls' 标志。设置为 true 以接受其中一个或多个可为空列为空的复合外键。

参数
list<string>|string $fields

要检查作为主键存在的字段或字段。

Cake\ORM\TableCake\ORM\Association|string $repository

将要查找字段的存储库,或存储库的关联名称。

array<string, mixed> $options optional

修改规则行为的选项。选项 'allowNullableNulls' 将在给定外键设置为 null 时使规则通过。注意:allowNullableNulls 不能通过数据库列设置为 NOT NULL 来传递。

__invoke() ¶ public

__invoke(Cake\Datasource\EntityInterface $entity, array<string, mixed> $options): bool

执行存在性检查

参数
Cake\Datasource\EntityInterface $entity

从中提取字段的实体

array<string, mixed> $options

传递给检查的选项,其中 repository 键是必需的。

返回值
bool
抛出
Cake\Database\Exception\DatabaseException
当规则引用未定义的关联时。

_fieldsAreNull() ¶ protected

_fieldsAreNull(Cake\Datasource\EntityInterface $entity, Cake\ORM\Table $source): bool

检查给定实体字段是否可为空且为空。

参数
Cake\Datasource\EntityInterface $entity

要检查的实体。

Cake\ORM\Table $source

要从中使用模式的表。

返回值
bool

属性详情

$_fields ¶ protected

要检查的字段列表

类型
list<string>

$_options ¶ protected

构造函数选项

类型
array<string, mixed>

$_repository ¶ protected

将要查找字段的存储库,或存储库的关联名称。

类型
Cake\ORM\TableCake\ORM\Association|string
OpenHub
Pingping
Linode
  • 商业解决方案
  • 展示
  • 文档
  • 书籍
  • API
  • 视频
  • 报告安全问题
  • 隐私政策
  • 标识和商标
  • 社区
  • 参与进来
  • 问题 (Github)
  • 面包店
  • 精选资源
  • 培训
  • 聚会
  • 我的 CakePHP
  • CakeFest
  • 通讯
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • 帮助与支持
  • 论坛
  • Stack Overflow
  • IRC
  • Slack
  • 付费支持

使用 CakePHP API 文档 生成