CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 4.0 Strawberry API

  • Overview
  • Version:
    • 4.0
      • 4.0
      • 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

Namespaces

  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
      • Association
      • Behavior
      • Exception
      • Locator
      • Rule
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

テーブルクラス

Class Table

単一のデータベーステーブルを表します。

Represents a single database table.

そこからデータを取得するためのメソッドを公開し、このテーブルと他のテーブルとの関連付けを管理します。 このクラスの複数のインスタンスを、同じデータベーステーブルに異なるエイリアスで作成できます。これにより、データベース構造をより豊かで表現力豊かな方法で処理できます。

Exposes methods for retrieving data out of it, and manages the associations this table has to other tables. Multiple instances of this class can be created for the same database table with different aliases, this allows you to address your database structure in a richer and more expressive way.

データを取得する

Retrieving data

データを取得する主な方法は、Table::find()を使用することです。 詳細については、そのメソッドを参照してください。

The primary way to retrieve data is using Table::find(). See that method for more information.

動的ファインダー

Dynamic finders

標準のfind($type)ファインダーメソッドに加えて、CakePHPは動的なファインダーメソッドを提供します。 これらのメソッドを使用すると、基本的な条件を簡単に設定できます。 たとえば、呼び出すユーザー名でユーザーをフィルタリングするには

In addition to the standard find($type) finder methods, CakePHP provides dynamic finder methods. These methods allow you to easily set basic conditions up. For example to filter users by username you would call
$query = $users->findByUsername('mark');

OrまたはAndを使用して、複数のフィールドの条件を組み合わせることもできます:

You can also combine conditions on multiple fields using either Or or And:
$query = $users->findByUsernameOrEmail('mark', '[email protected]');

一括更新/削除

Bulk updates/deletes

Table::updateAll()およびTable::deleteAll()を使用して、一括更新/削除を実行できます。 一括更新/削除のイベントは発生しないことに注意してください。

You can use Table::updateAll() and Table::deleteAll() to do bulk updates/deletes. You should be aware that events will not be fired for bulk updates/deletes.

イベント

Events

テーブルオブジェクトは、検索、削除、および保存操作中のライフサイクルフックとして、いくつかのイベントを発行します。 すべてのイベントはCakePHPイベントパッケージを使用します:

Table objects emit several events during as life-cycle hooks during find, delete and save operations. All events use the CakePHP event package:
  • Model.beforeFind各検索操作の前に発生します。 イベントを停止して戻り値を提供することで、検索操作を完全にバイパスできます。 $queryインスタンスに加えられた変更は、残りの検索の間保持されます。 $primaryパラメータは、これがルートクエリであるか、関連クエリであるかを示します。

    Model.beforeFind Fired before each find operation. By stopping the event and supplying a return value you can bypass the find operation entirely. Any changes done to the $query instance will be retained for the rest of the find. The $primary parameter indicates whether or not this is the root query, or an associated query.
  • Model.buildValidatorリスナーが、指定された名前付きバリデーターの検証ルールを変更できるようにします。

    Model.buildValidator Allows listeners to modify validation rules for the provided named validator.
  • Model.buildRulesリスナーがルールを追加して、ルールチェッカーを変更できるようにします。

    Model.buildRules Allows listeners to modify the rules checker by adding more rules.
  • Model.beforeRulesエンティティがルールチェッカーを使用して検証される前に発生します。 このイベントを停止することにより、ルールチェック操作の最終値を返すことができます。

    Model.beforeRules Fired before an entity is validated using the rules checker. By stopping this event, you can return the final value of the rules checking operation.
  • Model.afterRulesエンティティでルールがチェックされた後に発生します。 このイベントを停止することにより、ルールチェック操作の最終値を返すことができます。

    Model.afterRules Fired after the rules have been checked on the entity. By stopping this event, you can return the final value of the rules checking operation.
  • Model.beforeSave各エンティティが保存される前に発生します。 このイベントを停止すると、保存操作が中止されます。 イベントが停止すると、イベントの結果が返されます。

    Model.beforeSave Fired before each entity is saved. Stopping this event will abort the save operation. When the event is stopped the result of the event will be returned.
  • Model.afterSaveエンティティが保存された後に発生します。

    Model.afterSave Fired after an entity is saved.
  • Model.afterSaveCommit保存操作がラップされているトランザクションがコミットされた後に発生します。 また、データベース操作が暗黙的にコミットされる非アトミックな保存に対してもトリガーされます。 イベントは、save()が直接呼び出されるプライマリテーブルに対してのみトリガーされます。 saveを呼び出す前にトランザクションが開始された場合、イベントはトリガーされません。

    Model.afterSaveCommit Fired after the transaction in which the save operation is wrapped has been committed. It’s also triggered for non atomic saves where database operations are implicitly committed. The event is triggered only for the primary table on which save() is directly called. The event is not triggered if a transaction is started before calling save.
  • Model.beforeDeleteエンティティが削除される前に発生します。 このイベントを停止すると、削除操作が中止されます。

    Model.beforeDelete Fired before an entity is deleted. By stopping this event you will abort the delete operation.
  • Model.afterDeleteエンティティが削除された後に発生します。

    Model.afterDelete Fired after an entity has been deleted.

コールバック

Callbacks

以下のライフサイクルメソッドを実装することで、上記のイベントをテーブルクラスでサブスクライブできます:

You can subscribe to the events listed above in your table classes by implementing the lifecycle methods below:
  • beforeFind(EventInterface $event, Query $query, ArrayObject $options, boolean $primary)
  • buildValidator(EventInterface $event, Validator $validator, string $name)
  • buildRules(RulesChecker $rules)
  • beforeRules(EventInterface $event, EntityInterface $entity, ArrayObject $options, string $operation)
  • afterRules(EventInterface $event, EntityInterface $entity, ArrayObject $options, bool $result, string $operation)
  • beforeSave(EventInterface $event, EntityInterface $entity, ArrayObject $options)
  • afterSave(EventInterface $event, EntityInterface $entity, ArrayObject $options)
  • afterSaveCommit(EventInterface $event, EntityInterface $entity, ArrayObject $options)
  • beforeDelete(EventInterface $event, EntityInterface $entity, ArrayObject $options)
  • afterDelete(EventInterface $event, EntityInterface $entity, ArrayObject $options)
Namespace: Cake\ORM

定数の要約

Constants summary
  • string
    BUILD_VALIDATOR_EVENT ¶
    'Model.buildValidator'
  • string
    DEFAULT_VALIDATOR ¶
    'default'
  • string
    IS_UNIQUE_CLASS ¶
    \Cake\ORM\Rule\IsUnique::class
  • string
    RULES_CLASS ¶
    \Cake\ORM\RulesChecker::class
  • string
    VALIDATOR_PROVIDER_NAME ¶
    'table'

プロパティの要約

Properties summary
  • $_alias protected
    string

    この特定のインスタンスに与える人間の名前。 異なるエイリアスを使用することにより、同じデータベーステーブルを表す複数のオブジェクトが存在できます。

    Human name giving to this particular instance. Multiple objects representing the same database table can exist by using different aliases.
  • $_associations protected
    \Cake\ORM\AssociationCollection

    このテーブルの関連付けコンテナ。

    The associations container for this Table.
  • $_behaviors protected
    \Cake\ORM\BehaviorRegistry

    このテーブルのBehaviorRegistry

    BehaviorRegistry for this table
  • $_connection protected
    \Cake\Database\Connection|null

    接続インスタンス

    Connection instance
  • $_displayField protected
    string|string[]

    人間が読み取れる行の表現を表すフィールドの名前

    The name of the field that represents a human readable representation of a row
  • $_entityClass protected
    string

    このテーブルの単一の行を表すクラスの名前

    The name of the class that represent a single row for this table
  • $_eventClass protected
    string

    新しいイベントオブジェクトのデフォルトのクラス名。

    Default class name for new event objects.
  • $_eventManager protected
    \Cake\Event\EventManagerInterface

    このオブジェクトが内部イベントをディスパッチするために使用している Cake\Event\EventManager のインスタンス。

    Instance of the Cake\Event\EventManager this object is using to dispatch inner events.
  • $_primaryKey protected
    string|string[]

    テーブルの主キーを表すフィールドの名前

    The name of the field that represents the primary key in the table
  • $_registryAlias protected
    string|null

    このテーブルオブジェクトの作成に使用されるレジストリキー

    Registry key used to create this table object
  • $_rulesChecker protected
    \Cake\Datasource\RulesChecker

    このテーブルによって保存されたエンティティに適用されるドメインルール

    The domain rules to be applied to entities saved by this table
  • $_schema protected
    \Cake\Database\Schema\TableSchemaInterface|null

    このテーブルフィールドの説明を含むスキーマオブジェクト

    The schema object containing a description of this table fields
  • $_table protected
    string

    データベースで見つかるテーブルの名前

    Name of the table as it can be found in the database
  • $_validatorClass protected
    string

    バリデータークラス。

    Validator class.
  • $_validators protected
    \Cake\Validation\Validator[]

    名前で索引付けされた検証オブジェクトのリスト

    A list of validation objects indexed by name

Method Summary

メソッドの要約
  • __call() public

    動作の委任+動的ファインダーを処理します。

    Handles behavior delegation + dynamic finders.
  • __construct() public

    新しいインスタンスを初期化します

    Initializes a new instance
  • __debugInfo() public

    このオブジェクトの内部状態を説明するために使用できる配列を返します。

    Returns an array that can be used to describe the internal state of this object.
  • __get() public

    渡された値に基づいて名前が付けられた関連付けが存在する場合はそれを返し、そうでない場合は例外をスローします。

    Returns the association named after the passed value if exists, otherwise throws an exception.
  • __isset() public

    渡された値にちなんで名付けられた関連付けがこのテーブルに存在するかどうかを返します。

    Returns whether an association named after the passed value exists for this table.
  • _deleteMany() protected
  • _dynamicFinder() protected

    動的なfindByおよびfindByAllメソッドを提供します。

    Provides the dynamic findBy and findByAll methods.
  • _executeTransaction() protected

    トランザクション内でワーカーの実行ロジックを処理します。

    Handles the logic executing of a worker inside a transaction.
  • _getFindOrCreateQuery() protected

    findOrCreate() のクエリオブジェクトを取得します。

    Gets the query object for findOrCreate().
  • _initializeSchema() protected

    このテーブルで使用されるスキーマを変更するには、この関数をオーバーライドします。

    Override this function in order to alter the schema used by this table.
  • _insert() protected

    テーブルへのエンティティのデータの挿入を処理する補助関数

    Auxiliary function to handle the insert of an entity's data in the table
  • _newId() protected

    新しいレコードの主キー値を生成します。

    Generate a primary key value for a new record.
  • _onSaveSuccess() protected

    子の関連付けの保存を処理し、このテーブルのエンティティが正常に保存されると、afterSaveロジックを実行します。

    Handles the saving of children associations and executing the afterSave logic once the entity for this table has been saved successfully.
  • _processDelete() protected

    削除操作を実行します。

    Perform the delete operation.
  • _processFindOrCreate() protected

    渡されたオプションに基づいて、エンティティの実際の検索や作成を実行します。

    Performs the actual find and/or create of an entity based on the passed options.
  • _processSave() protected

    渡されたオプションに基づいて、エンティティの実際の保存を実行します。

    Performs the actual saving of an entity based on the passed options.
  • _saveMany() protected
  • _setFieldMatchers() protected

    オプション配列から、$keysで説明されているキーが配列であるかどうかを確認し、行が渡されたときに値配列内の各プロパティを連結するクロージャーの値を変更します。

    Out of an options array, check if the keys described in $keys are arrays and change the values for closures that will concatenate the each of the properties in the value array when passed a row.
  • _transactionCommitted() protected

    呼び出し元がトランザクションでコミットを実行したかどうかを確認します。

    Checks if the caller would have executed a commit on a transaction.
  • _update() protected

    テーブル内のエンティティのデータの更新を処理する補助関数

    Auxiliary function to handle the update of an entity's data in the table
  • addAssociations() public

    複数の関連付けを設定します。

    Setup multiple associations.
  • addBehavior() public

    動作を追加します。

    Add a behavior.
  • addBehaviors() public

    動作の配列をテーブルの動作コレクションに追加します。

    Adds an array of behaviors to the table's behavior collection.
  • aliasField() public

    テーブルの現在のエイリアスでフィールドをエイリアスします。

    Alias a field with the table's current alias.
  • associations() public

    このテーブルの関連コレクションを取得します。

    Get the associations collection for this table.
  • behaviors() public

    このテーブルの動作レジストリを返します。

    Returns the behavior registry for this table.
  • belongsTo() public

    このテーブルとターゲットテーブルの間に新しいBelongsTo関連付けを作成します。 "belongs to" (所属) の関連付けは、このテーブルがN側であるN-1の関係であり、このテーブル内のそれぞれについて、ターゲットテーブルに1つの関連付けられたレコードがあります。

    Creates a new BelongsTo association between this table and a target table. A "belongs to" association is a N-1 relationship where this table is the N side, and where there is a single associated record in the target table for each one in this table.
  • belongsToMany() public

    このテーブルとターゲットテーブルの間に新しいBelongsToMany関連付けを作成します。 "belongs to many" (多くに属する) 関連付けは、M-N関係です。

    Creates a new BelongsToMany association between this table and a target table. A "belongs to many" association is a M-N relationship.
  • buildRules() public

    指定されたオブジェクトを変更した後、RulesCheckerオブジェクトを返します。

    Returns a RulesChecker object after modifying the one that was supplied.
  • callFinder() public

    finderメソッドを直接呼び出し、渡されたクエリに適用します。クエリが渡されない場合は、新しいクエリが作成されて返されます

    Calls a finder method directly and applies it to the passed query, if no query is passed a new one will be created and returned
  • checkAliasLengths() protected

    クエリに使用されるすべてのテーブル名+列名の組み合わせが、データベースドライバーで許可されている最大長に適合するかどうかをチェックします。

    Checks if all table name + column name combinations used for queries fit into the max length allowed by database driver.
  • checkRules() public

    渡されたエンティティがルールチェッカーに保存されているすべてのルールに準拠しているかどうかを返します。

    Returns whether or not the passed entity complies with all the rules stored in the rules checker.
  • createValidator() protected

    クラス内のカスタムメソッドを使用してバリデーターを作成します。

    Creates a validator using a custom method inside your class.
  • defaultConnectionName() public static

    デフォルトの接続名を取得します。

    Get the default connection name.
  • delete() public

    単一のエンティティを削除します。

    Delete a single entity.
  • deleteAll() public

    指定された条件に一致するすべてのレコードを削除します。

    Deletes all records matching the provided conditions.
  • deleteMany() public

    テーブルの複数のエンティティを削除します。

    Deletes multiple entities of a table.
  • deleteManyOrFail() public

    テーブルの複数のエンティティを削除します。

    Deletes multiple entities of a table.
  • deleteOrFail() public

    エンティティを削除しようとするか、エンティティが新しい場合、主キー値がない場合、アプリケーションルールのチェックに失敗した場合、または削除がコールバックによって中止された場合は、PersistenceFailedExceptionをスローします。

    Try to delete an entity or throw a PersistenceFailedException if the entity is new, has no primary key value, application rules checks failed or the delete was aborted by a callback.
  • dispatchEvent() public

    イベントを作成およびディスパッチするためのラッパー。

    Wrapper for creating and dispatching events.
  • exists() public

    このリポジトリに指定された条件に一致するレコードがある場合、trueを返します。

    Returns true if there is any record in this repository matching the specified conditions.
  • find() public

    このリポジトリの新しいクエリを作成し、選択した検索のタイプに基づいていくつかのデフォルトを適用します。

    Creates a new Query for this repository and applies some defaults based on the type of search that was selected.
  • findAll() public

    渡されたクエリを返します。

    Returns the query as passed.
  • findAssociation() protected

    存在する場合、指定されたエイリアスに設定された関連オブジェクトを返します。

    Returns an association object configured for the specified alias if any.
  • findList() public

    クエリオブジェクトを設定して、結果がインデックス付き配列として表示されるようにします。これは、入力選択ボックスの入力など、リストが必要なあらゆる場所で役立ちます。

    Sets up a query object so results appear as an indexed array, useful for any place where you would want a list such as for populating input select boxes.
  • findOrCreate() public

    既存のレコードを検索するか、新しいレコードを作成します。

    Finds an existing record or creates a new one.
  • findThreaded() public

    このファインダーの結果はネストされた配列となり、モデルデータのparent_idフィールドを使用してネストされた結果を作成する場合に適しています。

    Results for this finder will be a nested array, and is appropriate if you want to use the parent_id field of your model data to build nested results.
  • get() public

    主キーで検索した後、単一のレコードを返します。レコードが見つからない場合、このメソッドは例外をスローします。

    Returns a single record after finding it by its primary key, if no record is found this method throws an exception.
  • getAlias() public

    テーブルのエイリアスを返します。

    Returns the table alias.
  • getAssociation() public

    指定されたエイリアスに設定された関連オブジェクトを返します。

    Returns an association object configured for the specified alias.
  • getBehavior() public

    レジストリから動作を取得します。

    Get a behavior from the registry.
  • getConnection() public

    接続インスタンスを返します。

    Returns the connection instance.
  • getDisplayField() public

    表示フィールドを返します。

    Returns the display field.
  • getEntityClass() public

    このテーブルの行をハイドレートするために使用されるクラスを返します。

    Returns the class used to hydrate rows for this table.
  • getEventManager() public

    このオブジェクトのCake\Event\EventManagerマネージャインスタンスを返します。

    Returns the Cake\Event\EventManager manager instance for this object.
  • getPrimaryKey() public

    主キーフィールド名を返します。

    Returns the primary key field name.
  • getRegistryAlias() public

    このテーブルインスタンスの作成に使用されるテーブルレジストリキーを返します。

    Returns the table registry key used to create this table instance.
  • getSaveOptionsBuilder() public

    SaveOptionsBuilderインスタンスを取得します。

    Gets a SaveOptionsBuilder instance.
  • getSchema() public

    このテーブルのプロパティを説明するスキーマテーブルオブジェクトを返します。

    Returns the schema table object describing this table's properties.
  • getTable() public

    データベーステーブル名を返します。

    Returns the database table name.
  • getValidator() public

    $nameでタグ付けされた検証ルールを返します。 複数の異なる名前付き検証セットを持つことが可能です。これは、システムの異なるルーチンから保存するときにさまざまなルールを使用する必要がある場合に役立ちます。

    Returns the validation rules tagged with $name. It is possible to have multiple different named validation sets, this is useful when you need to use varying rules when saving from different routines in your system.
  • hasAssociation() public

    このTableインスタンスに特定の関連付けが存在するかどうかを確認します。

    Checks whether a specific association exists on this Table instance.
  • hasBehavior() public

    指定されたエイリアスの動作が読み込まれているかどうかを確認します。

    Check if a behavior with the given alias has been loaded.
  • hasField() public

    テーブルに特定のフィールド/列があるかどうかをテストします。

    Test to see if a Table has a specific field/column.
  • hasFinder() public

    テーブルにファインダーが存在する場合はtrueを返します

    Returns true if the finder exists for the table
  • hasMany() public

    このテーブルとターゲットテーブルの間に新しいHasMany関連付けを作成します。 "has many"関連付けは1対Nの関係です。

    Creates a new HasMany association between this table and a target table. A "has many" association is a 1-N relationship.
  • hasOne() public

    このテーブルとターゲットテーブルの間に新しいHasOne関連付けを作成します。 "has one" (1つある) 関連付けは、1対1の関係です。

    Creates a new HasOne association between this table and a target table. A "has one" association is a 1-1 relationship.
  • hasValidator() public

    バリデーターが設定されているかどうかを確認します。

    Checks whether or not a validator has been set.
  • implementedEvents() public

    このテーブルが関心を持っているモデルコールバックを取得します。

    Get the Model callbacks this table is interested in.
  • initialize() public

    テーブルインスタンスを初期化します。 コンストラクタの後に呼び出されます。

    Initialize a table instance. Called after the constructor.
  • loadInto() public

    データベースで追加のクエリを実行し、結果を適切なプロパティにマージすることにより、渡されたエンティティまたはエンティティのリストに指定された関連付けを読み込みます。

    Loads the specified associations in the passed entity or list of entities by executing extra queries in the database and merging the results in the appropriate properties.
  • marshaller() public

    配列データをマーシャリング/オブジェクトに変換するために使用されるオブジェクトを取得します。

    Get the object used to marshal/convert array data into objects.
  • newEmptyEntity() public

    これにより、新しいエンティティオブジェクトが作成されます。

    This creates a new entity object.
  • newEntities() public

    配列からエンティティ+関連エンティティのリストを作成します。

    Create a list of entities + associated entities from an array.
  • newEntity() public

    配列から新しいエンティティ+関連付けられたエンティティを作成します。

    Create a new entity + associated entities from an array.
  • patchEntities() public

    $dataで渡された各要素を、エンティティで構成されたアクセス可能なフィールドに関して$entitiesで見つかったエンティティにマージします。

    Merges each of the elements passed in $data into the entities found in $entities respecting the accessible fields configured on the entities.
  • patchEntity() public

    エンティティで構成されたアクセス可能なフィールドを考慮して、渡された$dataを$entityにマージします。 変更後、同じエンティティを返します。

    Merges the passed $data into $entity respecting the accessible fields configured on the entity. Returns the same entity after being altered.
  • query() public

    テーブルの新しいQueryインスタンスを作成します。

    Creates a new Query instance for a table.
  • removeBehavior() public

    このテーブルの動作レジストリから動作を削除します。

    Removes a behavior from this table's behavior registry.
  • rulesChecker() public

    このインスタンスのRulesCheckerを返します。

    Returns the RulesChecker for this instance.
  • save() public

    ダーティとしてマークされたフィールドに基づいてエンティティを永続化し、保存が成功した後に同じエンティティを返します。エラーが発生した場合はfalseを返します。

    Persists an entity based on the fields that are marked as dirty and returns the same entity after a successful save or false in case of any error.
  • saveMany() public

    テーブルの複数のエンティティを保持します。

    Persists multiple entities of a table.
  • saveManyOrFail() public

    テーブルの複数のエンティティを保持します。

    Persists multiple entities of a table.
  • saveOrFail() public

    アプリケーションルールのチェックが失敗した場合、エンティティにエラーが含まれている場合、または保存がコールバックによって中止された場合は、エンティティを保存するか、PersistenceFailedExceptionをスローしてください。

    Try to save an entity or throw a PersistenceFailedException if the application rules checks failed, the entity contains errors or the save was aborted by a callback.
  • setAlias() public

    テーブルのエイリアスを設定します。

    Sets the table alias.
  • setConnection() public

    接続インスタンスを設定します。

    Sets the connection instance.
  • setDisplayField() public

    表示フィールドを設定します。

    Sets the display field.
  • setEntityClass() public

    このテーブルの行をハイドレートするために使用されるクラスを設定します。

    Sets the class used to hydrate rows for this table.
  • setEventManager() public

    このオブジェクトのCake\Event\EventManagerInterfaceインスタンスを返します。

    Returns the Cake\Event\EventManagerInterface instance for this object.
  • setPrimaryKey() public

    主キーフィールド名を設定します。

    Sets the primary key field name.
  • setRegistryAlias() public

    このテーブルインスタンスの作成に使用されるテーブルレジストリキーを設定します。

    Sets the table registry key used to create this table instance.
  • setSchema() public

    このテーブルのプロパティを説明するスキーマテーブルオブジェクトを設定します。

    Sets the schema table object describing this table's properties.
  • setTable() public

    データベーステーブル名を設定します。

    Sets the database table name.
  • setValidator() public

    このメソッドは、指定された名前でカスタムバリデーターを格納します。

    This method stores a custom validator under the given name.
  • updateAll() public

    一致するすべてのレコードを更新します。

    Update all matching records.
  • validateUnique() public

    列の値の一意性をチェックするために使用されるバリデーターメソッド。

    Validator method used to check the uniqueness of a value for a column.
  • validationDefault() public

    デフォルトのバリデーターオブジェクトを返します。 サブクラスはこの関数をオーバーライドして、デフォルトの検証セットをバリデーターオブジェクトに追加できます。

    Returns the default validator object. Subclasses can override this function to add a default validation set to the validator object.
  • validationMethodExists() protected

    検証メソッドが存在するかどうかを確認します。

    Checks if validation method exists.

メソッドの詳細

Method Detail

__call() public ¶

__call(mixed $method, mixed $args)

動作の委任+動的ファインダーを処理します。

Handles behavior delegation + dynamic finders.

テーブルが動作を使用する場合は、テーブルオブジェクト上にあるかのようにそれらを呼び出すことができます。

If your Table uses any behaviors you can call them as if they were on the table object.
Parameters
string $method

呼び出されるメソッドの名前

name of the method to be invoked
array $args

関数に渡される引数のリスト

List of arguments passed to the function
Returns
mixed
Throws
BadMethodCallException

__construct() public ¶

__construct(array $config)

新しいインスタンスを初期化します

Initializes a new instance

$config配列は次のキーを理解します:

The $config array understands the following keys:
  • table:表すデータベーステーブルの名前
    table: Name of the database table to represent
  • alias:このテーブルに割り当てられるエイリアス(デフォルトはテーブル名)
    alias: Alias to be assigned to this table (default to table name)
  • connection:使用する接続インスタンス
    connection: The connection instance to use
  • entityClass:このテーブルの行を表すエンティティクラスの完全な名前空間を持つクラス名。
    entityClass: The fully namespaced class name of the entity class that will represent rows in this table.
  • schema:\Cake\Database\Schema\TableSchemaInterfaceオブジェクトまたはそれに渡すことができる配列。
    schema: A \Cake\Database\Schema\TableSchemaInterface object or an array that can be passed to it.
  • eventManager:内部イベントに使用するイベントマネージャのインスタンス
    eventManager: An instance of an event manager to use for internal events
  • behaviors:BehaviorRegistry。 通常、テスト以外では使用されません。
    behaviors: A BehaviorRegistry. Generally not used outside of tests.
  • associations:AssociationCollectionインスタンス。
    associations: An AssociationCollection instance.
  • validator:"default"の検証セットまたは連想配列として割り当てられるValidatorインスタンス。ここで、keyは検証セットの名前で、Validatorインスタンスの値です。
    validator: A Validator instance which is assigned as the "default" validation set, or an associative array, where key is the name of the validation set and value the Validator instance.
Parameters
array $config optional

このテーブルのオプションのリスト

List of options for this table

__debugInfo() public ¶

__debugInfo()

このオブジェクトの内部状態を説明するために使用できる配列を返します。

Returns an array that can be used to describe the internal state of this object.
Returns
array

__get() public ¶

__get(mixed $property)

渡された値に基づいて名前が付けられた関連付けが存在する場合はそれを返し、そうでない場合は例外をスローします。

Returns the association named after the passed value if exists, otherwise throws an exception.
Parameters
string $property

協会名

the association name
Returns
\Cake\ORM\Association
Throws
RuntimeException
そのような名前との関連付けが存在しない場合
if no association with such name exists

__isset() public ¶

__isset(mixed $property)

渡された値にちなんで名付けられた関連付けがこのテーブルに存在するかどうかを返します。

Returns whether an association named after the passed value exists for this table.
Parameters
string $property

協会名

the association name
Returns
bool

_deleteMany() protected ¶

_deleteMany(iterable $entities, mixed $options)

Parameters
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface $entities

削除するエンティティ。

Entities to delete.
array|\ArrayAccess $options optional

使用されるオプション。

Options used.
Returns
\Cake\Datasource\EntityInterface|null

_dynamicFinder() protected ¶

_dynamicFinder(string $method, array $args)

動的なfindByおよびfindByAllメソッドを提供します。

Provides the dynamic findBy and findByAll methods.
Parameters
string $method

起動されたメソッド名。

The method name that was fired.
array $args

関数に渡される引数のリスト。

List of arguments passed to the function.
Returns
\Cake\ORM\Query
Throws
BadMethodCallException
引数が不足している場合、またはandとorを組み合わせた場合。
when there are missing arguments, or when and & or are combined.

_executeTransaction() protected ¶

_executeTransaction(callable $worker, bool $atomic)

トランザクション内でワーカーの実行ロジックを処理します。

Handles the logic executing of a worker inside a transaction.
Parameters
callable $worker

トランザクション内で実行されるワーカー。

The worker that will run inside the transaction.
bool $atomic optional

データベーストランザクション内でワーカーを実行するかどうか。

Whether to execute the worker inside a database transaction.
Returns
mixed

_getFindOrCreateQuery() protected ¶

_getFindOrCreateQuery(mixed $search)

findOrCreate() のクエリオブジェクトを取得します。

Gets the query object for findOrCreate().
Parameters
array|callable|\Cake\ORM\Query $search

既存のレコードを検索する基準。

The criteria to find existing records by.
Returns
\Cake\ORM\Query

_initializeSchema() protected ¶

_initializeSchema(\Cake\Database\Schema\TableSchemaInterface $schema)

このテーブルで使用されるスキーマを変更するには、この関数をオーバーライドします。

Override this function in order to alter the schema used by this table.

この関数は、データベースからスキーマをフェッチした後にのみ呼び出されます。 データベースに触れずにこのテーブルに独自のスキーマを提供したい場合は、schema() をオーバーライドするか、そのメソッドを介して定義を挿入できます。

This function is only called after fetching the schema out of the database. If you wish to provide your own schema to this table without touching the database, you can override schema() or inject the definitions though that method.

Example:

protected function _initializeSchema(\Cake\Database\Schema\TableSchemaInterface $schema) {
 $schema->setColumnType('preferences', 'json');
 return $schema;
}
Parameters
\Cake\Database\Schema\TableSchemaInterface $schema

データベースからフェッチされたテーブル定義。

The table definition fetched from database.
Returns
\Cake\Database\Schema\TableSchemaInterface

変更されたスキーマ

the altered schema

_insert() protected ¶

_insert(\Cake\Datasource\EntityInterface $entity, array $data)

テーブルへのエンティティのデータの挿入を処理する補助関数

Auxiliary function to handle the insert of an entity's data in the table
Parameters
\Cake\Datasource\EntityInterface $entity

$dataが抽出された対象エンティティ

the subject entity from were $data was extracted
array $data

保存する必要がある実際のデータ

The actual data that needs to be saved
Returns
\Cake\Datasource\EntityInterface|false
Throws
RuntimeException
テーブルに複合主キーが含まれている場合に、すべての主キーが提供されるか、生成される可能性がある場合。 または、テーブルに主キーがない場合。
if not all the primary keys where supplied or could be generated when the table has composite primary keys. Or when the table has no primary key.

_newId() protected ¶

_newId(array $primary)

新しいレコードの主キー値を生成します。

Generate a primary key value for a new record.

デフォルトでは、これは型システムを使用して、可能であれば新しい主キー値を生成します。 ID生成に特定の要件がある場合は、このメソッドをオーバーライドできます。

By default, this uses the type system to generate a new primary key value if possible. You can override this method if you have specific requirements for id generation.

注:ORMは複合主キーの主キー値を生成しません。 テーブルクラスの _newId() を上書きできます。

Note: The ORM will not generate primary key values for composite primary keys. You can overwrite _newId() in your table class.
Parameters
string[] $primary

新しいIDを取得する主キー列。

The primary key columns to get a new ID for.
Returns
string|null

null、主キー値、または主キー値のリスト。

Either null or the primary key value or a list of primary key values.

_onSaveSuccess() protected ¶

_onSaveSuccess(\Cake\Datasource\EntityInterface $entity, \ArrayObject $options)

子の関連付けの保存を処理し、このテーブルのエンティティが正常に保存されると、afterSaveロジックを実行します。

Handles the saving of children associations and executing the afterSave logic once the entity for this table has been saved successfully.
Parameters
\Cake\Datasource\EntityInterface $entity

保存するエンティティ

the entity to be saved
\ArrayObject $options

保存操作に使用するオプション

the options to use for the save operation
Returns
bool

成功の真実

True on success
Throws
Cake\ORM\Exception\RolledbackTransactionException
トランザクションがafterSaveイベントで中止された場合。
If the transaction is aborted in the afterSave event.

_processDelete() protected ¶

_processDelete(\Cake\Datasource\EntityInterface $entity, \ArrayObject $options)

削除操作を実行します。

Perform the delete operation.

指定されたエンティティを削除します。 依存関係から行を削除し、BelongsToMany関係の結合テーブルをクリアします。

Will delete the entity provided. Will remove rows from any dependent associations, and clear out join tables for BelongsToMany associations.
Parameters
\Cake\Datasource\EntityInterface $entity

削除するエンティティ。

The entity to delete.
\ArrayObject $options

削除のオプション。

The options for the delete.
Returns
bool

成功

success
Throws
InvalidArgumentException
渡されたエンティティの主キー値がない場合
if there are no primary key values of the passed entity

_processFindOrCreate() protected ¶

_processFindOrCreate(mixed $search, ?callable $callback, mixed $options)

渡されたオプションに基づいて、エンティティの実際の検索や作成を実行します。

Performs the actual find and/or create of an entity based on the passed options.
Parameters
array|callable|\Cake\ORM\Query $search

既存のレコードを検索するための基準、または呼び出し可能な検索基準は、検索クエリをカスタマイズします。

The criteria to find an existing record by, or a callable tha will customize the find query.
callable|null $callback optional

新しく作成されたエンティティに対して呼び出されるコールバック。 このコールバックは、エンティティが永続化される前に 呼び出されます。

A callback that will be invoked for newly created entities. This callback will be called before the entity is persisted.
array $options optional

保存時に使用するオプション。

The options to use when saving.
Returns
\Cake\Datasource\EntityInterface|array

エンティティ。

An entity.
Throws
Cake\ORM\Exception\PersistenceFailedException
エンティティを保存できなかった場合
When the entity couldn't be saved
InvalidArgumentException

_processSave() protected ¶

_processSave(\Cake\Datasource\EntityInterface $entity, \ArrayObject $options)

渡されたオプションに基づいて、エンティティの実際の保存を実行します。

Performs the actual saving of an entity based on the passed options.
Parameters
\Cake\Datasource\EntityInterface $entity

保存するエンティティ

the entity to be saved
\ArrayObject $options

保存操作に使用するオプション

the options to use for the save operation
Returns
\Cake\Datasource\EntityInterface|false
Throws
RuntimeException
エンティティに一部の主キーがない場合。
When an entity is missing some of the primary keys.
Cake\ORM\Exception\RolledbackTransactionException
トランザクションがafterSaveイベントで中止された場合。
If the transaction is aborted in the afterSave event.

_saveMany() protected ¶

_saveMany(iterable $entities, mixed $options)

Parameters
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface $entities

保存するエンティティ。

Entities to save.
array|\ArrayAccess|\Cake\ORM\SaveOptionsBuilder $options optional

各エンティティに対してTable::save()を呼び出すときに使用されるオプション。

Options used when calling Table::save() for each entity.
Returns
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface

エンティティリスト。

Entities list.
Throws
Cake\ORM\Exception\PersistenceFailedException
エンティティを保存できなかった場合。
If an entity couldn't be saved.
Exception
エンティティを保存できなかった場合。
If an entity couldn't be saved.

_setFieldMatchers() protected ¶

_setFieldMatchers(array $options, array $keys)

オプション配列から、$keysで説明されているキーが配列であるかどうかを確認し、行が渡されたときに値配列内の各プロパティを連結するクロージャーの値を変更します。

Out of an options array, check if the keys described in $keys are arrays and change the values for closures that will concatenate the each of the properties in the value array when passed a row.

これは、値を比較するときに複合キーを受け入れることができる結果フォーマッタに使用される補助関数です。

This is an auxiliary function used for result formatters that can accept composite keys when comparing values.
Parameters
array $options

ファインダーに渡された元のオプション

the original options passed to a finder
string[] $keys

$optionsをチェックインして、関連する値からマッチャーを構築するためのキー

the keys to check in $options to build matchers from the associated value
Returns
array

_transactionCommitted() protected ¶

_transactionCommitted(bool $atomic, bool $primary)

呼び出し元がトランザクションでコミットを実行したかどうかを確認します。

Checks if the caller would have executed a commit on a transaction.
Parameters
bool $atomic

アトミックトランザクションが使用された場合はTrue。

True if an atomic transaction was used.
bool $primary

プライマリが使用された場合は真。

True if a primary was used.
Returns
bool

トランザクションがコミットされた場合はtrueを返します。

Returns true if a transaction was committed.

_update() protected ¶

_update(\Cake\Datasource\EntityInterface $entity, array $data)

テーブル内のエンティティのデータの更新を処理する補助関数

Auxiliary function to handle the update of an entity's data in the table
Parameters
\Cake\Datasource\EntityInterface $entity

$dataが抽出された対象エンティティ

the subject entity from were $data was extracted
array $data

保存する必要がある実際のデータ

The actual data that needs to be saved
Returns
\Cake\Datasource\EntityInterface|false
Throws
InvalidArgumentException
主キーデータがない場合。
When primary key data is missing.

addAssociations() public ¶

addAssociations(array $params)

複数の関連付けを設定します。

Setup multiple associations.

これは、関連付けタイプによってインデックスが付けられたテーブル名のセットを含む配列を引数として受け取ります:

It takes an array containing set of table names indexed by association type as argument:
$this->Posts->addAssociations([
  'belongsTo' => [
    'Users' => ['className' => 'App\Model\Table\UsersTable']
  ],
  'hasMany' => ['Comments'],
  'belongsToMany' => ['Tags']
]);

各関連付けタイプは、キーがエイリアスであり、値が関連付け構成データである複数の関連付けを受け入れます。 数値キーが使用されている場合、値は関連エイリアスとして扱われます。

Each association type accepts multiple associations where the keys are the aliases, and the values are association config data. If numeric keys are used the values will be treated as association aliases.
Parameters
array $params

バインドする関連付けのセット(関連付けの種類によってインデックスが付けられます)

Set of associations to bind (indexed by association type)
Returns
$this
See Also
\Cake\ORM\Table::belongsTo()

\Cake\ORM\Table::hasOne()

\Cake\ORM\Table::hasMany()

\Cake\ORM\Table::belongsToMany()

addBehavior() public ¶

addBehavior(string $name, array $options)

動作を追加します。

Add a behavior.

このテーブルの動作コレクションに動作を追加します。 ビヘイビアーは、水平方向に再利用可能な機能を作成する簡単な方法を提供し、機能のような特性を提供し、イベントをリッスンできるようにします。

Adds a behavior to this table's behavior collection. Behaviors provide an easy way to create horizontally re-usable features that can provide trait like functionality, and allow for events to be listened to.

Example:

いくつかの設定でビヘイビアをロードします。

Load a behavior, with some settings.
$this->addBehavior('Tree', ['parent' => 'parentId']);

ビヘイビアーは通常、Table::initialize()中にロードされます。

Behaviors are generally loaded during Table::initialize().
Parameters
string $name

動作の名前。 短いクラス参照にすることができます。

The name of the behavior. Can be a short class reference.
array $options optional

使用する動作のオプション。

The options for the behavior to use.
Returns
$this
Throws
RuntimeException
動作がリロードされている場合。
If a behavior is being reloaded.
See Also
\Cake\ORM\Behavior

addBehaviors() public ¶

addBehaviors(array $behaviors)

動作の配列をテーブルの動作コレクションに追加します。

Adds an array of behaviors to the table's behavior collection.

Example:

$this->addBehaviors([
     'Timestamp',
     'Tree' => ['level' => 'level'],
]);
Parameters
array $behaviors

ロードするすべての動作。

All of the behaviors to load.
Returns
$this
Throws
RuntimeException
動作がリロードされている場合。
If a behavior is being reloaded.

aliasField() public ¶

aliasField(string $field)

テーブルの現在のエイリアスでフィールドをエイリアスします。

Alias a field with the table's current alias.

フィールドが既にエイリアスされている場合は、何も行われません。

If field is already aliased it will result in no-op.
Parameters
string $field

エイリアスするフィールド。

The field to alias.
Returns
string

テーブルエイリアスが前に付いたフィールド。

The field prefixed with the table alias.

associations() public ¶

associations()

このテーブルの関連コレクションを取得します。

Get the associations collection for this table.
Returns
\Cake\ORM\AssociationCollection

関連オブジェクトのコレクション。

The collection of association objects.

behaviors() public ¶

behaviors()

このテーブルの動作レジストリを返します。

Returns the behavior registry for this table.
Returns
\Cake\ORM\BehaviorRegistry

BehaviorRegistryインスタンス。

The BehaviorRegistry instance.

belongsTo() public ¶

belongsTo(string $associated, array $options)

このテーブルとターゲットテーブルの間に新しいBelongsTo関連付けを作成します。 "belongs to"(所属) の関連付けは、このテーブルがN側であるN-1の関係であり、このテーブル内のそれぞれについて、ターゲットテーブルに1つの関連付けられたレコードがあります。

Creates a new BelongsTo association between this table and a target table. A "belongs to" association is a N-1 relationship where this table is the N side, and where there is a single associated record in the target table for each one in this table.

ターゲットテーブルは、最初の引数で指定された名前で推測できます。または、インスタンス化するを渡すか、インスタンスを直接渡すことができます。

Target table can be inferred by its name, which is provided in the first argument, or you can either pass the to be instantiated or an instance of it directly.

オプション配列は次のキーを受け入れます:

The options array accept the following keys:
  • className:ターゲットテーブルオブジェクトのクラス名
    className: The class name of the target table object
  • targetTable:ターゲットテーブルとして使用されるテーブルオブジェクトのインスタンス
    targetTable: An instance of a table object to be used as the target table
  • foreignKey:外部キーとして使用するフィールドの名前。falseの場合、何も使用されません。
    foreignKey: The name of the field to use as foreign key, if false none will be used
  • conditions:結合をフィルタリングする条件のリストを含む配列
    conditions: array with a list of conditions to filter the join with
  • joinType:使用する結合のタイプ(例:INNER)
    joinType: The type of join to be used (e.g. INNER)
  • strategy:使用するローディング戦略。 'join'と 'select'がサポートされています。
    strategy: The loading strategy to use. 'join' and 'select' are supported.
  • finder:この関連付けからレコードをロードするときに使用するfinderメソッド。 デフォルトは'all'です。 ストラテジーが'join'の場合、フィールド、包含、および条件のみがファインダーから使用されます。
    finder: The finder method to use when loading records from this association. Defaults to 'all'. When the strategy is 'join', only the fields, containments, and where conditions will be used from the finder.

このメソッドは、構築された関連オブジェクトを返します。

This method will return the association object that was built.
Parameters
string $associated

ターゲットテーブルのエイリアス。 これは、関連付けを一意に識別するために使用されます

the alias for the target table. This is used to uniquely identify the association
array $options optional

関連付け定義を構成するためのオプションのリスト

list of options to configure the association definition
Returns
\Cake\ORM\Association\BelongsTo

belongsToMany() public ¶

belongsToMany(string $associated, array $options)

このテーブルとターゲットテーブルの間に新しいBelongsToMany関連付けを作成します。 "belongs to many" (多くに属する)関連付けは、M-N関係です。

Creates a new BelongsToMany association between this table and a target table. A "belongs to many" association is a M-N relationship.

ターゲットテーブルは、最初の引数で指定された名前で推測できます。または、インスタンス化するクラス名またはそのインスタンスを直接渡すこともできます。

Target table can be inferred by its name, which is provided in the first argument, or you can either pass the class name to be instantiated or an instance of it directly.

オプション配列は次のキーを受け入れます:

The options array accept the following keys:
  • className:ターゲットテーブルオブジェクトのクラス名。
    className: The class name of the target table object.
  • targetTable:ターゲットテーブルとして使用されるテーブルオブジェクトのインスタンス。
    targetTable: An instance of a table object to be used as the target table.
  • foreignKey:外部キーとして使用するフィールドの名前。
    foreignKey: The name of the field to use as foreign key.
  • targetForeignKey:ターゲットの外部キーとして使用するフィールドの名前。
    targetForeignKey: The name of the field to use as the target foreign key.
  • joinTable:2つの間のリンクを表すテーブルの名前
    joinTable: The name of the table representing the link between the two
  • through:すでにインスタンス化されているリンクテーブルを使用する場合は、このキーを、この関連付けのソーステーブルとターゲットテーブルの両方への関連付けを含む構成済みのTableインスタンスに設定します。
    through: If you choose to use an already instantiated link table, set this key to a configured Table instance containing associations to both the source and target tables in this association.
  • dependent:所有するレコードが削除されたときにジャンクションテーブルのレコードを削除しない場合は、falseに設定します。
    dependent: Set to false, if you do not want junction table records removed when an owning record is removed.
  • CascadeCallbacks:カスケード削除でCakePHPがコールバックを起動するようにしたい場合はtrueに設定します。 falseの場合、ORMはdeleteAll()を使用してデータを削除します。 真の結合/接合テーブルレコードがロードされると、削除されます。
    cascadeCallbacks: Set to true if you want CakePHP to fire callbacks on cascaded deletes. If false the ORM will use deleteAll() to remove data. When true join/junction table records will be loaded and then deleted.
  • conditions:結合をフィルタリングする条件のリストを含む配列。
    conditions: array with a list of conditions to filter the join with.
  • sort:この関連付けの結果が返される順序。
    sort: The order in which results for this association should be returned.
  • strategy:結果の選択に使用する戦略。「選択」または「サブクエリ」。 サブクエリが選択されている場合、ソーステーブルで結果を返すために使用されるクエリは、ターゲットテーブルで行を取得するための条件として使用されます。
    strategy: The strategy to be used for selecting results Either 'select' or 'subquery'. If subquery is selected the query used to return results in the source table will be used as conditions for getting rows in the target table.
  • saveStrategy:「追加」または「置換」。 関連するエンティティの保存に使用するモードを示します。 前者はリレーションの両側の間にのみ新しいリンクを作成し、後者はワイプと置換を行って、保存時に渡されたエンティティ間のリンクを作成します。
    saveStrategy: Either 'append' or 'replace'. Indicates the mode to be used for saving associated entities. The former will only create new links between both side of the relation and the latter will do a wipe and replace to create the links between the passed entities when saving.
  • strategy:使用するローディング戦略。 「select」と「subquery」がサポートされています。
    strategy: The loading strategy to use. 'select' and 'subquery' are supported.
  • finder:この関連付けからレコードをロードするときに使用するfinderメソッド。 デフォルトは'all'です。
    finder: The finder method to use when loading records from this association. Defaults to 'all'.

このメソッドは、構築された関連オブジェクトを返します。

This method will return the association object that was built.
Parameters
string $associated

ターゲットテーブルのエイリアス。 これは、関連付けを一意に識別するために使用されます

the alias for the target table. This is used to uniquely identify the association
array $options optional

関連付け定義を構成するためのオプションのリスト

list of options to configure the association definition
Returns
\Cake\ORM\Association\BelongsToMany

buildRules() public ¶

buildRules(\Cake\ORM\RulesChecker $rules)

指定されたオブジェクトを変更した後、RulesCheckerオブジェクトを返します。

Returns a RulesChecker object after modifying the one that was supplied.

このインスタンスによって保存されたエンティティに適用されるルールを初期化するには、サブクラスでこのメソッドをオーバーライドする必要があります。

Subclasses should override this method in order to initialize the rules to be applied to entities saved by this instance.
Parameters
\Cake\ORM\RulesChecker $rules

変更するルールオブジェクト。

The rules object to be modified.
Returns
\Cake\ORM\RulesChecker

callFinder() public ¶

callFinder(string $type, \Cake\ORM\Query $query, array $options)

finderメソッドを直接呼び出し、渡されたクエリに適用します。クエリが渡されない場合は、新しいクエリが作成されて返されます

Calls a finder method directly and applies it to the passed query, if no query is passed a new one will be created and returned
Parameters
string $type

呼び出されるファインダーの名前

name of the finder to be called
\Cake\ORM\Query $query

ファインダーオプションを適用するクエリオブジェクト

The query object to apply the finder options to
array $options optional

ファインダーに渡すオプションのリスト

List of options to pass to the finder
Returns
\Cake\ORM\Query
Throws
BadMethodCallException

checkAliasLengths() protected ¶

checkAliasLengths()

クエリに使用されるすべてのテーブル名+列名の組み合わせが、データベースドライバーで許可されている最大長に適合するかどうかをチェックします。

Checks if all table name + column name combinations used for queries fit into the max length allowed by database driver.
Throws
RuntimeException
エイリアスの組み合わせが長すぎる場合
When an alias combination is too long

checkRules() public ¶

checkRules(\Cake\Datasource\EntityInterface $entity, string $operation, mixed $options)

渡されたエンティティがルールチェッカーに保存されているすべてのルールに準拠しているかどうかを返します。

Returns whether or not the passed entity complies with all the rules stored in the rules checker.
Parameters
\Cake\Datasource\EntityInterface $entity

有効性を確認するエンティティ。

The entity to check for validity.
string $operation optional

実行中の操作。 'create'(作成)、'update'(更新)、または'delete'(削除)のいずれか。

The operation being run. Either 'create', 'update' or 'delete'.
\ArrayObject|array|null $options optional

ルールに渡されるオプション。

The options To be passed to the rules.
Returns
bool

createValidator() protected ¶

createValidator(string $name)

クラス内のカスタムメソッドを使用してバリデーターを作成します。

Creates a validator using a custom method inside your class.

このメソッドは、新しいバリデーターを作成するためにのみ使用され、オブジェクトに格納されません。 バリデーターを作成して再利用する場合は、代わりにgetValidator()メソッドを使用してください。

This method is used only to build a new validator and it does not store it in your object. If you want to build and reuse validators, use getValidator() method instead.
Parameters
string $name

作成する検証セットの名前。

The name of the validation set to create.
Returns
\Cake\Validation\Validator
Throws
RuntimeException

defaultConnectionName() public static ¶

defaultConnectionName()

デフォルトの接続名を取得します。

Get the default connection name.

このメソッドは、インスタンスが接続なしでTableLocatorを介して作成された場合に、フォールバック接続名を取得するために使用されます。

This method is used to get the fallback connection name if an instance is created through the TableLocator without a connection.
Returns
string
See Also
\Cake\ORM\Locator\TableLocator::get()

delete() public ¶

delete(\Cake\Datasource\EntityInterface $entity, mixed $options)

単一のエンティティを削除します。

Delete a single entity.

関連付けの定義時に使用された'dependent'(依存)オプションに基づいて、エンティティと関連する可能性のある関連付けをデータベースから削除します。

Deletes an entity and possibly related associations from the database based on the 'dependent' option used when defining the association.
Parameters
\Cake\Datasource\EntityInterface $entity

削除するエンティティ。

The entity to remove.
array|\ArrayAccess $options optional

削除のオプション。

The options for the delete.
Returns
bool

成功

success

deleteAll() public ¶

deleteAll(mixed $conditions)

指定された条件に一致するすべてのレコードを削除します。

Deletes all records matching the provided conditions.

このメソッドはbeforeDelete/afterDeleteイベントをトリガーしません。 それらが必要な場合は、最初にレコードのコレクションをロードして削除します。

This method will not trigger beforeDelete/afterDelete events. If you need those first load a collection of records and delete them.

このメソッドは、関連付けのcascade属性では実行されません。 このメソッドと組み合わせてカスケード削除が必要な場合は、データベース外部キー+ ON CASCADEルールを使用する必要があります。

This method will not execute on associations' cascade attribute. You should use database foreign keys + ON CASCADE rules if you need cascading deletes combined with this method.
Parameters
mixed $conditions

使用する条件は、Query::where()がとることができるすべてのものを受け入れます。

Conditions to be used, accepts anything Query::where() can take.
Returns
int

影響を受けた行の数を返します。

Returns the number of affected rows.
See Also
\Cake\Datasource\RepositoryInterface::delete()

deleteMany() public ¶

deleteMany(iterable $entities, mixed $options)

テーブルの複数のエンティティを削除します。

Deletes multiple entities of a table.

レコードはトランザクションで削除されます。トランザクションは、検証の失敗またはデータベースエラーのためにレコードのいずれかを削除できなかった場合にロールバックされます。

The records will be deleted in a transaction which will be rolled back if any one of the records fails to delete due to failed validation or database error.
Parameters
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface $entities

削除するエンティティ。

Entities to delete.
array|\ArrayAccess $options optional

各エンティティに対してTable::save()を呼び出すときに使用されるオプション。

Options used when calling Table::save() for each entity.
Returns
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface|false

エンティティは成功するとリストに表示され、失敗するとfalseと表示されます。

Entities list on success, false on failure.
See Also
\Cake\ORM\Table::delete()
このメソッドに関連するオプションとイベント。
for options and events related to this method.

deleteManyOrFail() public ¶

deleteManyOrFail(iterable $entities, mixed $options)

テーブルの複数のエンティティを削除します。

Deletes multiple entities of a table.

レコードはトランザクションで削除されます。トランザクションは、検証の失敗またはデータベースエラーのためにレコードのいずれかを削除できなかった場合にロールバックされます。

The records will be deleted in a transaction which will be rolled back if any one of the records fails to delete due to failed validation or database error.
Parameters
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface $entities

削除するエンティティ。

Entities to delete.
array|\ArrayAccess $options optional

各エンティティに対してTable::save()を呼び出すときに使用されるオプション。

Options used when calling Table::save() for each entity.
Returns
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface

エンティティリスト。

Entities list.
Throws
Cake\ORM\Exception\PersistenceFailedException
See Also
\Cake\ORM\Table::delete()
このメソッドに関連するオプションとイベント。
for options and events related to this method.

deleteOrFail() public ¶

deleteOrFail(\Cake\Datasource\EntityInterface $entity, mixed $options)

エンティティを削除しようとするか、エンティティが新しい場合、主キー値がない場合、アプリケーションルールのチェックに失敗した場合、または削除がコールバックによって中止された場合は、PersistenceFailedExceptionをスローします。

Try to delete an entity or throw a PersistenceFailedException if the entity is new, has no primary key value, application rules checks failed or the delete was aborted by a callback.
Parameters
\Cake\Datasource\EntityInterface $entity

削除するエンティティ。

The entity to remove.
array|\ArrayAccess $options optional

削除のオプション。

The options for the delete.
Returns
true
Throws
Cake\ORM\Exception\PersistenceFailedException
See Also
\Cake\ORM\Table::delete()

dispatchEvent() public ¶

dispatchEvent(string $name, ?array $data, ?object $subject)

イベントを作成およびディスパッチするためのラッパー。

Wrapper for creating and dispatching events.

ディスパッチされたイベントを返します。

Returns a dispatched event.
Parameters
string $name

イベントの名前。

Name of the event.
array|null $data optional

このイベントでトランスポートしたい値は、リスナーが読み取ることができます。

Any value you wish to be transported with this event to it can be read by listeners.
object|null $subject optional

このイベントが適用されるオブジェクト(デフォルトでは$this)。

The object that this event applies to ($this by default).
Returns
\Cake\Event\EventInterface

exists() public ¶

exists(mixed $conditions)

このリポジトリに指定された条件に一致するレコードがある場合、trueを返します。

Returns true if there is any record in this repository matching the specified conditions.
Parameters
array $conditions

クエリに渡す条件のリスト

list of conditions to pass to the query
Returns
bool

find() public ¶

find(string $type, array $options)

このリポジトリの新しいクエリを作成し、選択した検索のタイプに基づいていくつかのデフォルトを適用します。

Creates a new Query for this repository and applies some defaults based on the type of search that was selected.

Model.beforeFind event

各find()は、アタッチされたすべてのリスナーに対してModel.beforeFindイベントをトリガーします。 リスナーは、$queryを使用して有効な結果セットを設定できます

Each find() will trigger a Model.beforeFind event for all attached listeners. Any listener can set a valid result set using $query

デフォルトでは、$optionsは次のキーを認識します:

By default, $options will recognize the following keys:
  • fields
  • conditions
  • order
  • limit
  • offset
  • page
  • group
  • having
  • contain
  • join

使用法

Usage

オプション配列を使用する:

Using the options array:
$query = $articles->find('all', [
  'conditions' => ['published' => 1],
  'limit' => 10,
  'contain' => ['Users', 'Comments']
]);

ビルダーインターフェイスの使用:

Using the builder interface:
$query = $articles->find()
  ->where(['published' => 1])
  ->limit(10)
  ->contain(['Users', 'Comments']);

ファインダーを呼び出す

Calling finders

find()メソッドは、カスタムファインダーメソッドのエントリポイントです。 タイプを指定して、ファインダーを呼び出すことができます:

The find() method is the entry point for custom finder methods. You can invoke a finder by specifying the type:
$query = $articles->find('published');

findPublishedメソッドを呼び出します。

Would invoke the findPublished method.
Parameters
string $type optional

実行するクエリのタイプ

the type of query to perform
array $options optional

Query::applyOptions()に渡される配列

An array that will be passed to Query::applyOptions()
Returns
\Cake\ORM\Query

クエリビルダー

The query builder

findAll() public ¶

findAll(\Cake\ORM\Query $query, array $options)

渡されたクエリを返します。

Returns the query as passed.

デフォルトでは、findAll()は条件を適用しません。サブクラスでこのメソッドをオーバーライドして、find('all')の動作を変更できます。

By default findAll() applies no conditions, you can override this method in subclasses to modify how find('all') works.
Parameters
\Cake\ORM\Query $query

検索するクエリ

The query to find with
array $options

検索に使用するオプション

The options to use for the find
Returns
\Cake\ORM\Query

クエリビルダー

The query builder

findAssociation() protected ¶

findAssociation(string $name)

存在する場合、指定されたエイリアスに設定された関連オブジェクトを返します。

Returns an association object configured for the specified alias if any.

name引数は、より深い関連付けにアクセスするためのドット構文もサポートしています。

The name argument also supports dot syntax to access deeper associations.
$users = $this->getAssociation('Articles.Comments.Users');
Parameters
string $name

関連付けに使用されるエイリアス。

The alias used for the association.
Returns
\Cake\ORM\Association|null

関連付けまたはnull。

Either the association or null.

findList() public ¶

findList(\Cake\ORM\Query $query, array $options)

クエリオブジェクトを設定して、結果がインデックス付き配列として表示されるようにします。これは、入力選択ボックスの入力など、リストが必要なあらゆる場所で役立ちます。

Sets up a query object so results appear as an indexed array, useful for any place where you would want a list such as for populating input select boxes.

このファインダーを呼び出すときに、渡されたフィールドを使用して、配列のキー、値、およびオプションで結果をグループ化するものとして使用するものを決定します。 デフォルトでは、モデルの主キーがキーに使用され、表示フィールドが値として使用されます。

When calling this finder, the fields passed are used to determine what should be used as the array key, value and optionally what to group the results by. By default the primary key for the model is used for the key, and the display field as value.

このファインダーの結果は、次の形式になります:

The results of this finder will be in the following form:
[
 1 => 'value for id 1',
 2 => 'value for id 2',
 4 => 'value for id 4'
]

$options配列を使用して、キーとして使用するプロパティと値として使用するプロパティを指定できます。指定しない場合は、このテーブルでそれぞれprimaryKeyとdisplayFieldを呼び出した結果を使用します:

You can specify which property will be used as the key and which as value by using the $options array, when not specified, it will use the results of calling primaryKey and displayField respectively in this table:
$table->find('list', [
 'keyField' => 'name',
 'valueField' => 'age'
]);

プロパティを共有する場合、結果をより大きなグループにまとめることができます。groupFieldを設定することにより、グループ化に使用するプロパティをカスタマイズできます:

Results can be put together in bigger groups when they share a property, you can customize the property to use for grouping by setting groupField:
$table->find('list', [
 'groupField' => 'category_id',
]);

groupFieldを使用すると、結果は次の形式で返されます:

When using a groupField results will be returned in this format:
[
 'group_1' => [
     1 => 'value for id 1',
     2 => 'value for id 2',
 ]
 'group_2' => [
     4 => 'value for id 4'
 ]
]
Parameters
\Cake\ORM\Query $query

検索するクエリ

The query to find with
array $options

検索のオプション

The options for the find
Returns
\Cake\ORM\Query

クエリビルダー

The query builder

findOrCreate() public ¶

findOrCreate(mixed $search, ?callable $callback, mixed $options)

既存のレコードを検索するか、新しいレコードを作成します。

Finds an existing record or creates a new one.

$searchで定義された属性を使用して既存のレコードを見つけるために、find()が実行されます。 レコードが条件に一致する場合、最初のレコードが返されます。

A find() will be done to locate an existing record using the attributes defined in $search. If records matches the conditions, the first record will be returned.

レコードが見つからない場合は、$searchプロパティを使用して新しいエンティティが作成されます。 コールバックが提供されている場合、それが呼び出され、追加のデフォルト値を定義できます。 新しいエンティティが保存されて返されます。

If no record can be found, a new entity will be created with the $search properties. If a callback is provided, it will be called allowing you to define additional default values. The new entity will be saved and returned.

検索条件にカスタムの順序、関連付け、または条件が必要な場合、$searchパラメータは、クエリを引数として受け取る呼び出し可能オブジェクト、または$searchパラメータとして渡される \Cake\ORM\Query オブジェクトにすることができます。 検索結果をカスタマイズできます。

If your find conditions require custom order, associations or conditions, then the $search parameter can be a callable that takes the Query as the argument, or a \Cake\ORM\Query object passed as the $search parameter. Allowing you to customize the find results.

Options

オプション配列は、以下のキーを除いて、saveメソッドに渡されます:

The options array is passed to the save method with exception to the following keys:
  • atomic:データベーストランザクション内で検索、保存、およびコールバックのメソッドを実行するかどうか(デフォルト:true)
    atomic: Whether to execute the methods for find, save and callbacks inside a database transaction (default: true)
  • defaults:検索基準を新しいエンティティのデフォルト値として使用するかどうか(デフォルト:true)
    defaults: Whether to use the search criteria as default values for the new entity (default: true)
Parameters
array|callable|\Cake\ORM\Query $search

既存のレコードを検索する基準。 クエリオブジェクトを渡すときは、保存する前にメソッドの2番目の引数を使用してエンティティデータを変更する必要があることに注意してください。

The criteria to find existing records by. Note that when you pass a query object you'll have to use the 2nd arg of the method to modify the entity data before saving.
callable|null $callback optional

新しく作成されたエンティティに対して呼び出されるコールバック。 このコールバックは、エンティティが永続化される前に呼び出されます。

A callback that will be invoked for newly created entities. This callback will be called before the entity is persisted.
array $options optional

保存時に使用するオプション。

The options to use when saving.
Returns
\Cake\Datasource\EntityInterface

エンティティ。

An entity.
Throws
Cake\ORM\Exception\PersistenceFailedException
エンティティを保存できなかったとき
When the entity couldn't be saved

findThreaded() public ¶

findThreaded(\Cake\ORM\Query $query, array $options)

このファインダーの結果はネストされた配列となり、モデルデータのparent_idフィールドを使用してネストされた結果を作成する場合に適しています。

Results for this finder will be a nested array, and is appropriate if you want to use the parent_id field of your model data to build nested results.

parent_id値に基づいて親行に属する値は、childrenプロパティを使用して親行の値内に再帰的にネストされます

Values belonging to a parent row based on their parent_id value will be recursively nested inside the parent row values using the children property

結果のネストに使用するフィールドをカスタマイズできます。デフォルトでは、主キーとparent_idフィールドが使用されます。 これらのデフォルトを変更したい場合は、$optionsにキーkeyField、parentFieldまたはnestingKeyを指定する必要があります:

You can customize what fields are used for nesting results, by default the primary key and the parent_id fields are used. If you wish to change these defaults you need to provide the keys keyField, parentField or nestingKey in $options:
$table->find('threaded', [
 'keyField' => 'id',
 'parentField' => 'ancestor_id'
 'nestingKey' => 'children'
]);
Parameters
\Cake\ORM\Query $query

検索するクエリ

The query to find with
array $options

検索するオプション

The options to find with
Returns
\Cake\ORM\Query

クエリビルダー

The query builder

get() public ¶

get(mixed $primaryKey, array $options)

主キーで検索した後、単一のレコードを返します。レコードが見つからない場合、このメソッドは例外をスローします。

Returns a single record after finding it by its primary key, if no record is found this method throws an exception.

Example:

$id = 10;
$article = $articles->get($id);

$article = $articles->get($id, ['contain' => ['Comments]]);
Parameters
mixed $primaryKey

検索する主キー値

primary key value to find
array $options optional

Table::find()が受け入れるオプション

options accepted by Table::find()
Returns
\Cake\Datasource\EntityInterface
Throws
Cake\Datasource\Exception\RecordNotFoundException
そのようなIDのレコードが見つからなかった場合
if the record with such id could not be found
Cake\Datasource\Exception\InvalidPrimaryKeyException
$primaryKeyの要素数が正しくない場合。
When $primaryKey has an incorrect number of elements.
Cake\Datasource\Exception\RecordNotFoundException
そのようなIDのレコードが見つからなかった場合
if the record with such id could not be found
See Also
\Cake\Datasource\RepositoryInterface::find()

\Cake\Datasource\RepositoryInterface::find()

getAlias() public ¶

getAlias()

テーブルのエイリアスを返します。

Returns the table alias.
Returns
string

getAssociation() public ¶

getAssociation(string $name)

指定されたエイリアスに設定された関連オブジェクトを返します。

Returns an association object configured for the specified alias.

name引数は、より深い関連付けにアクセスするためのドット構文もサポートしています。

The name argument also supports dot syntax to access deeper associations.
$users = $this->getAssociation('Articles.Comments.Users');

このメソッドは関連付けが存在する必要があるか、そうでなければ例外をスローすることに注意してください。 不明な場合は、このメソッドを呼び出す前にhasAssociation()を使用してください。

Note that this method requires the association to be present or otherwise throws an exception. If you are not sure, use hasAssociation() before calling this method.
Parameters
string $name

関連付けに使用されるエイリアス。

The alias used for the association.
Returns
\Cake\ORM\Association

協会。

The association.
Throws
InvalidArgumentException

getBehavior() public ¶

getBehavior(string $name)

レジストリから動作を取得します。

Get a behavior from the registry.
Parameters
string $name

レジストリから取得する動作エイリアス。

The behavior alias to get from the registry.
Returns
\Cake\ORM\Behavior
Throws
InvalidArgumentException
動作が存在しない場合。
If the behavior does not exist.

getConnection() public ¶

getConnection()

接続インスタンスを返します。

Returns the connection instance.
Returns
\Cake\Database\Connection

getDisplayField() public ¶

getDisplayField()

表示フィールドを返します。

Returns the display field.
Returns
string|string[]|null

getEntityClass() public ¶

getEntityClass()

このテーブルの行をハイドレートするために使用されるクラスを返します。

Returns the class used to hydrate rows for this table.
Returns
string

getEventManager() public ¶

getEventManager()

このオブジェクトの Cake\Event\EventManager マネージャインスタンスを返します。

Returns the Cake\Event\EventManager manager instance for this object.

このインスタンスを使用して、新しいリスナーまたはコールバックをオブジェクトイベントに登録したり、独自のイベントを作成して自由にトリガーしたりできます。

You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.
Returns
\Cake\Event\EventManagerInterface

getPrimaryKey() public ¶

getPrimaryKey()

主キーフィールド名を返します。

Returns the primary key field name.
Returns
string|string[]

getRegistryAlias() public ¶

getRegistryAlias()

このテーブルインスタンスの作成に使用されるテーブルレジストリキーを返します。

Returns the table registry key used to create this table instance.
Returns
string

getSaveOptionsBuilder() public ¶

getSaveOptionsBuilder(array $options)

SaveOptionsBuilderインスタンスを取得します。

Gets a SaveOptionsBuilder instance.
Parameters
array $options optional

ビルダーが解析するオプション。

Options to parse by the builder.
Returns
\Cake\ORM\SaveOptionsBuilder

getSchema() public ¶

getSchema()

このテーブルのプロパティを説明するスキーマテーブルオブジェクトを返します。

Returns the schema table object describing this table's properties.
Returns
\Cake\Database\Schema\TableSchemaInterface

getTable() public ¶

getTable()

データベーステーブル名を返します。

Returns the database table name.

これには、setTable()を使用して設定した場合、データベーススキーマ名を含めることができます。

This can include the database schema name if set using setTable().
Returns
string

getValidator() public ¶

getValidator(?string $name)

$name でタグ付けされた検証ルールを返します。 複数の異なる名前付き検証セットを持つことが可能です。これは、システムの異なるルーチンから保存するときにさまざまなルールを使用する必要がある場合に役立ちます。

Returns the validation rules tagged with $name. It is possible to have multiple different named validation sets, this is useful when you need to use varying rules when saving from different routines in your system.

以前にバリデーターが設定されていない場合、このメソッドはクラス内のメソッドを使用してバリエーターを構築します。

If a validator has not been set earlier, this method will build a valiator using a method inside your class.

たとえば、「forSubscription」という検証セットを作成する場合は、次のようにTableサブクラスにメソッドを作成する必要があります:

For example, if you wish to create a validation set called 'forSubscription', you will need to create a method in your Table subclass as follows:
public function validationForSubscription($validator)
{
 return $validator
 ->add('email', 'valid-email', ['rule' => 'email'])
 ->add('password', 'valid', ['rule' => 'notBlank'])
 ->requirePresence('username');
}
$validator = $this->getValidator('forSubscription');

他のセットが指定されていない場合に適用される検証セットが必要な場合は、Table サブクラスの validationDefault にメソッドを実装できます。

You can implement the method in validationDefault in your Table subclass should you wish to have a validation set that applies in cases where no other set is specified.

$name 引数が指定されていない場合、デフォルトのバリデーターが返されます。 デフォルトのバリデーター名は、 DEFAULT_VALIDATOR クラス定数で構成できます。

If a $name argument has not been provided, the default validator will be returned. You can configure your default validator name in a DEFAULT_VALIDATOR class constant.
Parameters
string|null $name optional

返す検証セットの名前。

The name of the validation set to return.
Returns
\Cake\Validation\Validator

hasAssociation() public ¶

hasAssociation(string $name)

このTableインスタンスに特定の関連付けが存在するかどうかを確認します。

Checks whether a specific association exists on this Table instance.

name引数は、より深い関連付けにアクセスするためのドット構文もサポートしています。

The name argument also supports dot syntax to access deeper associations.
$hasUsers = $this->hasAssociation('Articles.Comments.Users');
Parameters
string $name

関連付けに使用されるエイリアス。

The alias used for the association.
Returns
bool

hasBehavior() public ¶

hasBehavior(string $name)

指定されたエイリアスの動作が読み込まれているかどうかを確認します。

Check if a behavior with the given alias has been loaded.
Parameters
string $name

チェックする動作エイリアス。

The behavior alias to check.
Returns
bool

動作が存在するかどうか。

Whether or not the behavior exists.

hasField() public ¶

hasField(string $field)

テーブルに特定のフィールド/列があるかどうかをテストします。

Test to see if a Table has a specific field/column.

スキーマオブジェクトに委任し、 Schema\Table インスタンスを使用して列の存在を確認します。

Delegates to the schema object and checks for column presence using the Schema\Table instance.
Parameters
string $field

チェックするフィールド。

The field to check for.
Returns
bool

フィールドが存在する場合はtrue、存在しない場合はfalse。

True if the field exists, false if it does not.

hasFinder() public ¶

hasFinder(string $type)

テーブルにファインダーが存在する場合はtrueを返します

Returns true if the finder exists for the table
Parameters
string $type

チェックするファインダーの名前

name of finder to check
Returns
bool

hasMany() public ¶

hasMany(string $associated, array $options)

このテーブルとターゲットテーブルの間に新しいHasMany関連付けを作成します。 「has many」関連付けは1対Nの関係です。

Creates a new HasMany association between this table and a target table. A "has many" association is a 1-N relationship.

ターゲットテーブルは、最初の引数で提供されるその名前から推測できます。または、インスタンス化するクラス名またはそのインスタンスを直接渡すこともできます。

Target table can be inferred by its name, which is provided in the first argument, or you can either pass the class name to be instantiated or an instance of it directly.

オプション配列は次のキーを受け入れます:

The options array accept the following keys:
  • className:ターゲットテーブルオブジェクトのクラス名
    className: The class name of the target table object
  • targetTable:ターゲットテーブルとして使用されるテーブルオブジェクトのインスタンス
    targetTable: An instance of a table object to be used as the target table
  • foreignKey:外部キーとして使用するフィールドの名前。falseの場合、何も使用されません。
    foreignKey: The name of the field to use as foreign key, if false none will be used
  • dependent:このテーブルでエンティティが削除されたときに、関連付けられたテーブルに削除をカスケードする場合は、trueに設定します。 関連するテーブルの削除操作は、それ以上カスケードされません。 再帰的なカスケードを取得するには、cascadeCallbacksも有効にします。 CakePHPに関連データを削除させたくない場合、またはデータベース制約を使用している場合は、falseに設定します。
    dependent: Set to true if you want CakePHP to cascade deletes to the associated table when an entity is removed on this table. The delete operation on the associated table will not cascade further. To get recursive cascades enable cascadeCallbacks as well. Set to false if you don't want CakePHP to remove associated data, or when you are using database constraints.
  • CascadeCallbacks:カスケード削除でCakePHPがコールバックを起動するようにしたい場合はtrueに設定します。 falseの場合、ORMはdeleteAll()を使用してデータを削除します。 真のレコードがロードされた後、削除されます。
    cascadeCallbacks: Set to true if you want CakePHP to fire callbacks on cascaded deletes. If false the ORM will use deleteAll() to remove data. When true records will be loaded and then deleted.
  • conditions:結合をフィルタリングする条件のリストを含む配列
    conditions: array with a list of conditions to filter the join with
  • sort:この関連付けの結果が返される順序
    sort: The order in which results for this association should be returned
  • saveStrategy:「追加」または「置換」。 「追加」すると、現在のレコードがデータベース内のすべてのレコードに追加されます。 現在のセットにない「置換」関連レコードは削除されます。 外部キーがnull可能な列である場合、またはdependentがtrueの場合、レコードは孤立します。
    saveStrategy: Either 'append' or 'replace'. When 'append' the current records are appended to any records in the database. When 'replace' associated records not in the current set will be removed. If the foreign key is a null able column or if dependent is true records will be orphaned.
  • strategy:結果の選択に使用する戦略。「選択」または「サブクエリ」。 サブクエリが選択されている場合、ソーステーブルで結果を返すために使用されるクエリは、ターゲットテーブルで行を取得するための条件として使用されます。
    strategy: The strategy to be used for selecting results Either 'select' or 'subquery'. If subquery is selected the query used to return results in the source table will be used as conditions for getting rows in the target table.
  • finder:この関連付けからレコードをロードするときに使用するfinderメソッド。 デフォルトは 'all' です。
    finder: The finder method to use when loading records from this association. Defaults to 'all'.

このメソッドは、構築された関連オブジェクトを返します。

This method will return the association object that was built.
Parameters
string $associated

ターゲットテーブルのエイリアス。 これは、関連付けを一意に識別するために使用されます

the alias for the target table. This is used to uniquely identify the association
array $options optional

関連付け定義を構成するためのオプションのリスト

list of options to configure the association definition
Returns
\Cake\ORM\Association\HasMany

hasOne() public ¶

hasOne(string $associated, array $options)

このテーブルとターゲットテーブルの間に新しいHasOne関連付けを作成します。 "has one" 関連付けは、1対1の関係です。

Creates a new HasOne association between this table and a target table. A "has one" association is a 1-1 relationship.

ターゲットテーブルは、最初の引数で提供されるその名前から推測できます。または、インスタンス化するクラス名またはそのインスタンスを直接渡すこともできます。

Target table can be inferred by its name, which is provided in the first argument, or you can either pass the class name to be instantiated or an instance of it directly.

オプション配列は次のキーを受け入れます:

The options array accept the following keys:
  • className:ターゲットテーブルオブジェクトのクラス名
    className: The class name of the target table object
  • targetTable:ターゲットテーブルとして使用されるテーブルオブジェクトのインスタンス
    targetTable: An instance of a table object to be used as the target table
  • foreignKey:外部キーとして使用するフィールドの名前。falseの場合、何も使用されません。
    foreignKey: The name of the field to use as foreign key, if false none will be used
  • dependent:このテーブルでエンティティが削除されたときに、関連付けられたテーブルに削除をカスケードする場合は、trueに設定します。 関連するテーブルの削除操作は、それ以上カスケードされません。 再帰的なカスケードを取得するには、cascadeCallbacks も有効にします。 CakePHPに関連データを削除させたくない場合、またはデータベース制約を使用している場合は、falseに設定します。
    dependent: Set to true if you want CakePHP to cascade deletes to the associated table when an entity is removed on this table. The delete operation on the associated table will not cascade further. To get recursive cascades enable cascadeCallbacks as well. Set to false if you don't want CakePHP to remove associated data, or when you are using database constraints.
  • CascadeCallbacks:カスケード削除でCakePHPがコールバックを起動するようにしたい場合はtrueに設定します。 falseの場合、ORMはdeleteAll() を使用してデータを削除します。 真のレコードがロードされた後、削除されます。
    cascadeCallbacks: Set to true if you want CakePHP to fire callbacks on cascaded deletes. If false the ORM will use deleteAll() to remove data. When true records will be loaded and then deleted.
  • conditions:結合をフィルタリングする条件のリストを含む配列
    conditions: array with a list of conditions to filter the join with
  • joinType:使用する結合のタイプ(例:LEFT)
    joinType: The type of join to be used (e.g. LEFT)
  • strategy:使用するローディング戦略。 'join'と 'select'がサポートされています。
    strategy: The loading strategy to use. 'join' and 'select' are supported.
  • finder:この関連付けからレコードをロードするときに使用するfinderメソッド。 デフォルトは 'all' です。 ストラテジーが 'join' の場合、フィールド、包含、および条件のみがファインダーから使用されます。
    finder: The finder method to use when loading records from this association. Defaults to 'all'. When the strategy is 'join', only the fields, containments, and where conditions will be used from the finder.

このメソッドは、構築された関連オブジェクトを返します。

This method will return the association object that was built.
Parameters
string $associated

ターゲットテーブルのエイリアス。 これは、関連付けを一意に識別するために使用されます

the alias for the target table. This is used to uniquely identify the association
array $options optional

関連付け定義を構成するためのオプションのリスト

list of options to configure the association definition
Returns
\Cake\ORM\Association\HasOne

hasValidator() public ¶

hasValidator(string $name)

バリデーターが設定されているかどうかを確認します。

Checks whether or not a validator has been set.
Parameters
string $name

バリデーターの名前。

The name of a validator.
Returns
bool

implementedEvents() public ¶

implementedEvents()

このテーブルが関心を持っているモデルコールバックを取得します。

Get the Model callbacks this table is interested in.

従来のメソッドを実装することにより、テーブルクラスは関連するイベントに関心があると見なされます。

By implementing the conventional methods a table class is assumed to be interested in the related event.

従来とは異なるイベントリスナーを追加する必要がある場合は、このメソッドをオーバーライドします。 または、テーブルに標準以外のイベントをリッスンさせたい場合。

Override this method if you need to add non-conventional event listeners. Or if you want you table to listen to non-standard events.

従来のメソッドマップは次のとおりです:

The conventional method map is:
  • Model.beforeMarshal => beforeMarshal
  • Model.buildValidator => buildValidator
  • Model.beforeFind => beforeFind
  • Model.beforeSave => beforeSave
  • Model.afterSave => afterSave
  • Model.afterSaveCommit => afterSaveCommit
  • Model.beforeDelete => beforeDelete
  • Model.afterDelete => afterDelete
  • Model.afterDeleteCommit => afterDeleteCommit
  • Model.beforeRules => beforeRules
  • Model.afterRules => afterRules
Returns
array

initialize() public ¶

initialize(array $config)

テーブルインスタンスを初期化します。 コンストラクタの後に呼び出されます。

Initialize a table instance. Called after the constructor.

このメソッドを使用して、関連付けを定義し、動作を定義して検証を定義し、必要なその他の初期化ロジックを実行できます。

You can use this method to define associations, attach behaviors define validation and do any other initialization logic you need.
 public function initialize(array $config)
 {
     $this->belongsTo('Users');
     $this->belongsToMany('Tagging.Tags');
     $this->setPrimaryKey('something_else');
 }
Parameters
array $config

コンストラクターに渡される構成オプション

Configuration options passed to the constructor

loadInto() public ¶

loadInto(mixed $entities, array $contain)

データベースで追加のクエリを実行し、結果を適切なプロパティにマージすることにより、渡されたエンティティまたはエンティティのリストに指定された関連付けを読み込みます。

Loads the specified associations in the passed entity or list of entities by executing extra queries in the database and merging the results in the appropriate properties.

Example:

$user = $usersTable->get(1);
$user = $usersTable->loadInto($user, ['Articles.Tags', 'Articles.Comments']);
echo $user->articles[0]->title;

複数のエンティティの関連付けを一度に読み込むこともできます

You can also load associations for multiple entities at once

Example:

$users = $usersTable->find()->where([...])->toList();
$users = $usersTable->loadInto($users, ['Articles.Tags', 'Articles.Comments']);
echo $user[1]->articles[0]->title;

ロードされる関連付けのプロパティは、各エンティティで上書きされます。

The properties for the associations to be loaded will be overwritten on each entity.
Parameters
\Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[] $entities

単一のエンティティまたはエンティティのリスト

a single entity or list of entities
array $contain

contain() 互換の配列。

A contain() compatible array.
Returns
\Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[]
See Also
\Cake\ORM\Query::contain()

marshaller() public ¶

marshaller()

配列データをマーシャリング/オブジェクトに変換するために使用されるオブジェクトを取得します。

Get the object used to marshal/convert array data into objects.

テーブルオブジェクトでカスタムマーシャリングロジックを使用する場合は、このメソッドをオーバーライドします。

Override this method if you want a table object to use custom marshalling logic.
Returns
\Cake\ORM\Marshaller
See Also
\Cake\ORM\Marshaller

newEmptyEntity() public ¶

newEmptyEntity()

これにより、新しいエンティティオブジェクトが作成されます。

This creates a new entity object.

注意:これはフィールド検証をトリガーしません。 このエンティティは、空のレコードとして検証エラーなしで永続化できます。 保存する前に、必ず必須フィールドにパッチを適用してください。

Careful: This does not trigger any field validation. This entity can be persisted without validation error as empty record. Always patch in required fields before saving.
Returns
\Cake\Datasource\EntityInterface

newEntities() public ¶

newEntities(array $data, array $options)

配列からエンティティ+関連エンティティのリストを作成します。

Create a list of entities + associated entities from an array.

これは、要求データをハイドレーションしてエンティティに戻すときに最も役立ちます。 たとえば、コントローラーコードでは次のようになります:

This is most useful when hydrating request data back into entities. For example, in your controller code:
$articles = $this->Articles->newEntities($this->request->getData());

その後、水和されたエンティティを反復して保存できます。

The hydrated entities can then be iterated and saved.
Parameters
array $data

エンティティを構築するためのデータ。

The data to build an entity with.
array $options optional

オブジェクトのハイドレーションのオプションのリスト。

A list of options for the objects hydration.
Returns
\Cake\Datasource\EntityInterface[]

ハイドレートされたレコードの配列。

An array of hydrated records.

newEntity() public ¶

newEntity(array $data, array $options)

配列から新しいエンティティ+関連付けられたエンティティを作成します。

Create a new entity + associated entities from an array.

これは、要求データをハイドレーションしてエンティティに戻すときに最も役立ちます。 たとえば、コントローラーコードでは次のようになります:

This is most useful when hydrating request data back into entities. For example, in your controller code:
$article = $this->Articles->newEntity($this->request->getData());

水和されたエンティティは、エンティティが保存されるときに、データベースに存在する主キーデータに基づいて正しく挿入/更新を行います。 エンティティが保存されるまで、分離されたレコードになります。

The hydrated entity will correctly do an insert/update based on the primary key data existing in the database when the entity is saved. Until the entity is saved, it will be a detached record.
Parameters
array $data

エンティティを構築するためのデータ。

The data to build an entity with.
array $options optional

オブジェクトのハイドレーションのオプションのリスト。

A list of options for the object hydration.
Returns
\Cake\Datasource\EntityInterface

patchEntities() public ¶

patchEntities(iterable $entities, array $data, array $options)

$dataで渡された各要素を、エンティティで構成されたアクセス可能なフィールドに関して$entitiesで見つかったエンティティにマージします。

Merges each of the elements passed in $data into the entities found in $entities respecting the accessible fields configured on the entities.

マージは、$dataと$entitiesの各要素の主キーを照合することによって行われます。

Merging is done by matching the primary key in each of the elements in $data and $entities.

これは、リクエストデータを使用して既存のエンティティのリストを編集する場合に最も役立ちます:

This is most useful when editing a list of existing entities using request data:
$article = $this->Articles->patchEntities($articles, $this->request->getData());
Parameters
\Cake\Datasource\EntityInterface[]|\Traversable $entities

データをマージするエンティティ

the entities that will get the data merged in
array $data

エンティティにマージされる配列のリスト

list of arrays to be merged into the entities
array $options optional

オブジェクトのハイドレーションのオプションのリスト。

A list of options for the objects hydration.
Returns
\Cake\Datasource\EntityInterface[]

patchEntity() public ¶

patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options)

エンティティで構成されたアクセス可能なフィールドを考慮して、渡された$dataを$entityにマージします。 変更後、同じエンティティを返します。

Merges the passed $data into $entity respecting the accessible fields configured on the entity. Returns the same entity after being altered.

これは、リクエストデータを使用して既存のエンティティを編集する場合に最も便利です:

This is most useful when editing an existing entity using request data:
$article = $this->Articles->patchEntity($article, $this->request->getData());
Parameters
\Cake\Datasource\EntityInterface $entity

マージされるデータを取得するエンティティ

the entity that will get the data merged in
array $data

エンティティにマージされるフィールドのキー値リスト

key value list of fields to be merged into the entity
array $options optional

オブジェクトのハイドレーションのオプションのリスト。

A list of options for the object hydration.
Returns
\Cake\Datasource\EntityInterface

query() public ¶

query()

テーブルの新しいQueryインスタンスを作成します。

Creates a new Query instance for a table.
Returns
\Cake\ORM\Query

removeBehavior() public ¶

removeBehavior(string $name)

このテーブルの動作レジストリから動作を削除します。

Removes a behavior from this table's behavior registry.

Example:

このテーブルから動作を削除します。

Remove a behavior from this table.
$this->removeBehavior('Tree');
Parameters
string $name

動作が追加されたエイリアス。

The alias that the behavior was added with.
Returns
$this
See Also
\Cake\ORM\Behavior

rulesChecker() public ¶

rulesChecker()

このインスタンスのRulesCheckerを返します。

Returns the RulesChecker for this instance.

RulesCheckerオブジェクトは、関連するデータソースからフェッチする必要のある複雑なロジックまたはデータを含む可能性のあるルールの有効性についてエンティティをテストするために使用されます。

A RulesChecker object is used to test an entity for validity on rules that may involve complex logic or data that needs to be fetched from relevant datasources.
Returns
\Cake\Datasource\RulesChecker
See Also
\Cake\Datasource\RulesChecker

save() public ¶

save(\Cake\Datasource\EntityInterface $entity, mixed $options)

ダーティとしてマークされたフィールドに基づいてエンティティを永続化し、保存が成功した後に同じエンティティを返します。エラーが発生した場合はfalseを返します。

Persists an entity based on the fields that are marked as dirty and returns the same entity after a successful save or false in case of any error.
Parameters
\Cake\Datasource\EntityInterface $entity

保存するエンティティ

the entity to be saved
array|\ArrayAccess|\Cake\ORM\SaveOptionsBuilder $options optional

保存時に使用するオプション。

The options to use when saving.
Returns
\Cake\Datasource\EntityInterface|false
Throws
Cake\ORM\Exception\RolledbackTransactionException
トランザクションがafterSaveイベントで中止された場合。
If the transaction is aborted in the afterSave event.

saveMany() public ¶

saveMany(iterable $entities, mixed $options)

テーブルの複数のエンティティを保持します。

Persists multiple entities of a table.

レコードはトランザクションで保存され、検証またはデータベースエラーが原因でレコードのいずれかが保存に失敗した場合は、ロールバックされます。

The records will be saved in a transaction which will be rolled back if any one of the records fails to save due to failed validation or database error.
Parameters
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface $entities

保存するエンティティ。

Entities to save.
array|\ArrayAccess|\Cake\ORM\SaveOptionsBuilder $options optional

各エンティティに対してTable::save()を呼び出すときに使用されるオプション。

Options used when calling Table::save() for each entity.
Returns
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface|false

失敗した場合はfalse、成功した場合はエンティティリスト。

False on failure, entities list on success.
Throws
Exception

saveManyOrFail() public ¶

saveManyOrFail(iterable $entities, mixed $options)

テーブルの複数のエンティティを保持します。

Persists multiple entities of a table.

レコードはトランザクションで保存され、検証またはデータベースエラーが原因でレコードのいずれかが保存に失敗した場合は、ロールバックされます。

The records will be saved in a transaction which will be rolled back if any one of the records fails to save due to failed validation or database error.
Parameters
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface $entities

保存するエンティティ。

Entities to save.
array|\ArrayAccess $options optional

各エンティティに対してTable::save()を呼び出すときに使用されるオプション。

Options used when calling Table::save() for each entity.
Returns
\Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface

エンティティリスト。

Entities list.
Throws
Exception

Cake\ORM\Exception\PersistenceFailedException
エンティティを保存できなかった場合。
If an entity couldn't be saved.

saveOrFail() public ¶

saveOrFail(\Cake\Datasource\EntityInterface $entity, mixed $options)

アプリケーションルールのチェックが失敗した場合、エンティティにエラーが含まれている場合、または保存がコールバックによって中止された場合は、エンティティを保存するか、PersistenceFailedExceptionをスローしてください。

Try to save an entity or throw a PersistenceFailedException if the application rules checks failed, the entity contains errors or the save was aborted by a callback.
Parameters
\Cake\Datasource\EntityInterface $entity

保存するエンティティ

the entity to be saved
array|\ArrayAccess $options optional

保存時に使用するオプション。

The options to use when saving.
Returns
\Cake\Datasource\EntityInterface
Throws
Cake\ORM\Exception\PersistenceFailedException
エンティティを保存できなかったとき
When the entity couldn't be saved
See Also
\Cake\ORM\Table::save()

setAlias() public ¶

setAlias(string $alias)

テーブルのエイリアスを設定します。

Sets the table alias.
Parameters
string $alias

テーブルのエイリアス

Table alias
Returns
$this

setConnection() public ¶

setConnection(\Cake\Database\Connection $connection)

接続インスタンスを設定します。

Sets the connection instance.
Parameters
\Cake\Database\Connection $connection

接続インスタンス

The connection instance
Returns
$this

setDisplayField() public ¶

setDisplayField(mixed $field)

表示フィールドを設定します。

Sets the display field.
Parameters
string|string[] $field

表示フィールドとして使用される名前。

Name to be used as display field.
Returns
$this

setEntityClass() public ¶

setEntityClass(string $name)

このテーブルの行をハイドレートするために使用されるクラスを設定します。

Sets the class used to hydrate rows for this table.
Parameters
string $name

使用するクラスの名前

The name of the class to use
Returns
$this
Throws
Cake\ORM\Exception\MissingEntityException
エンティティークラスが見つからない場合
when the entity class cannot be found

setEventManager() public ¶

setEventManager(\Cake\Event\EventManagerInterface $eventManager)

このオブジェクトの Cake\Event\EventManagerInterface インスタンスを返します。

Returns the Cake\Event\EventManagerInterface instance for this object.

このインスタンスを使用して、新しいリスナーまたはコールバックをオブジェクトイベントに登録したり、独自のイベントを作成して自由にトリガーしたりできます。

You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.
Parameters
\Cake\Event\EventManagerInterface $eventManager

設定するeventManager

the eventManager to set
Returns
$this

setPrimaryKey() public ¶

setPrimaryKey(mixed $key)

主キーフィールド名を設定します。

Sets the primary key field name.
Parameters
string|string[] $key

主キーとして使用する新しい名前を設定します

Sets a new name to be used as primary key
Returns
$this

setRegistryAlias() public ¶

setRegistryAlias(string $registryAlias)

このテーブルインスタンスの作成に使用されるテーブルレジストリキーを設定します。

Sets the table registry key used to create this table instance.
Parameters
string $registryAlias

このオブジェクトへのアクセスに使用されるキー。

The key used to access this object.
Returns
$this

setSchema() public ¶

setSchema(mixed $schema)

このテーブルのプロパティを説明するスキーマテーブルオブジェクトを設定します。

Sets the schema table object describing this table's properties.

配列が渡されると、新しいTableSchemaInterfaceが配列から作成され、このテーブルのスキーマとして使用されます。

If an array is passed, a new TableSchemaInterface will be constructed out of it and used as the schema for this table.
Parameters
array|\Cake\Database\Schema\TableSchemaInterface $schema

このテーブルに使用されるスキーマ

Schema to be used for this table
Returns
$this

setTable() public ¶

setTable(string $table)

データベーステーブル名を設定します。

Sets the database table name.

これには、「schema.table」の形式でデータベーススキーマ名を含めることができます。 名前を引用する必要がある場合は、自動識別子引用を有効にします。

This can include the database schema name in the form 'schema.table'. If the name must be quoted, enable automatic identifier quoting.
Parameters
string $table

テーブル名。

Table name.
Returns
$this

setValidator() public ¶

setValidator(string $name, \Cake\Validation\Validator $validator)

このメソッドは、指定された名前でカスタムバリデーターを格納します。

This method stores a custom validator under the given name.

自分でオブジェクトを作成して、オブジェクトに保存できます:

You can build the object by yourself and store it in your object:
$validator = new \Cake\Validation\Validator($table);
$validator
 ->add('email', 'valid-email', ['rule' => 'email'])
 ->add('password', 'valid', ['rule' => 'notBlank'])
 ->allowEmpty('bio');
$this->setValidator('forSubscription', $validator);
Parameters
string $name

設定するバリデーターの名前。

The name of a validator to be set.
\Cake\Validation\Validator $validator

設定するバリデーターオブジェクト。

Validator object to be set.
Returns
$this

updateAll() public ¶

updateAll(mixed $fields, mixed $conditions)

一致するすべてのレコードを更新します。

Update all matching records.

$ fieldsを$ conditionsに基づいて提供された値に設定します。 このメソッドは beforeSave/afterSave イベントをトリガーしません。 それらが必要な場合は、まずレコードのコレクションをロードして更新します。

Sets the $fields to the provided values based on $conditions. This method will not trigger beforeSave/afterSave events. If you need those first load a collection of records and update them.
Parameters
string|array|\Closure|\Cake\Database\Expression\QueryExpression $fields

フィールドのハッシュ => 新しい値。

A hash of field => new value.
mixed $conditions

使用する条件は、Query::where() がとることができるすべてのものを受け入れます。

Conditions to be used, accepts anything Query::where() can take.
Returns
int

カウント影響を受ける行を返します。

Count Returns the affected rows.

validateUnique() public ¶

validateUnique(mixed $value, array $options, ?array $context)

列の値の一意性をチェックするために使用されるバリデーターメソッド。

Validator method used to check the uniqueness of a value for a column.

これは検証APIで使用するためのものであり、直接呼び出されることはありません。

This is meant to be used with the validation API and not to be called directly.

Example:

$validator->add('email', [
 'unique' => ['rule' => 'validateUnique', 'provider' => 'table']
])

一意の検証のスコープを別の列の値にすることができます:

Unique validation can be scoped to the value of another column:
$validator->add('email', [
 'unique' => [
     'rule' => ['validateUnique', ['scope' => 'site_id']],
     'provider' => 'table'
 ]
]);

上記の例では、電子メールの一意性は、同じsite_idを持つ行のみにスコープされます。 スコープは、検証するデータにスコープフィールドが存在する場合にのみ使用されます。

In the above example, the email uniqueness will be scoped to only rows having the same site_id. Scoping will only be used if the scoping field is present in the data to be validated.
Parameters
mixed $value

一意性をチェックする列の値。

The value of column to be checked for uniqueness.
array $options

オプションの配列。オプションで 'scope'キーを含みます。 オプションがない場合、検証コンテキストになることもあります。

The options array, optionally containing the 'scope' key. May also be the validation context, if there are no options.
array|null $context optional

検証コンテキストまたはnullのいずれか。

Either the validation context or null.
Returns
bool

値が一意の場合はtrue、非スカラーで非一意の値が指定された場合はfalse。

True if the value is unique, or false if a non-scalar, non-unique value was given.

validationDefault() public ¶

validationDefault(\Cake\Validation\Validator $validator)

デフォルトのバリデーターオブジェクトを返します。 サブクラスはこの関数をオーバーライドして、デフォルトの検証セットをバリデーターオブジェクトに追加できます。

Returns the default validator object. Subclasses can override this function to add a default validation set to the validator object.
Parameters
\Cake\Validation\Validator $validator

いくつかのルールを追加するために変更できるバリデーター。

The validator that can be modified to add some rules to it.
Returns
\Cake\Validation\Validator

validationMethodExists() protected ¶

validationMethodExists(string $name)

検証メソッドが存在するかどうかを確認します。

Checks if validation method exists.
Parameters
string $name

検証メソッド名。

Validation method name.
Returns
bool

プロパティの詳細

Property Detail

$_alias ¶ protected

この特定のインスタンスに与える人間の名前。 異なるエイリアスを使用することにより、同じデータベーステーブルを表す複数のオブジェクトを存在させることができます。

Human name giving to this particular instance. Multiple objects representing the same database table can exist by using different aliases.
Type
string

$_associations ¶ protected

このテーブルの関連付けコンテナ。

The associations container for this Table.
Type
\Cake\ORM\AssociationCollection

$_behaviors ¶ protected

このテーブルのBehaviorRegistry

BehaviorRegistry for this table
Type
\Cake\ORM\BehaviorRegistry

$_connection ¶ protected

接続インスタンス

Connection instance
Type
\Cake\Database\Connection|null

$_displayField ¶ protected

人間が読み取れる行の表現を表すフィールドの名前

The name of the field that represents a human readable representation of a row
Type
string|string[]

$_entityClass ¶ protected

このテーブルの単一の行を表すクラスの名前

The name of the class that represent a single row for this table
Type
string

$_eventClass ¶ protected

新しいイベントオブジェクトのデフォルトのクラス名。

Default class name for new event objects.
Type
string

$_eventManager ¶ protected

このオブジェクトが内部イベントをディスパッチするために使用している Cake\Event\EventManager のインスタンス。

Instance of the Cake\Event\EventManager this object is using to dispatch inner events.
Type
\Cake\Event\EventManagerInterface

$_primaryKey ¶ protected

テーブルの主キーを表すフィールドの名前

The name of the field that represents the primary key in the table
Type
string|string[]

$_registryAlias ¶ protected

このテーブルオブジェクトの作成に使用されるレジストリキー

Registry key used to create this table object
Type
string|null

$_rulesChecker ¶ protected

このテーブルによって保存されたエンティティに適用されるドメインルール

The domain rules to be applied to entities saved by this table
Type
\Cake\Datasource\RulesChecker

$_schema ¶ protected

このテーブルフィールドの説明を含むスキーマオブジェクト

The schema object containing a description of this table fields
Type
\Cake\Database\Schema\TableSchemaInterface|null

$_table ¶ protected

データベースで見つかるテーブルの名前

Name of the table as it can be found in the database
Type
string

$_validatorClass ¶ protected

バリデータークラス。

Validator class.
Type
string

$_validators ¶ protected

名前で索引付けされた検証オブジェクトのリスト

A list of validation objects indexed by name
Type
\Cake\Validation\Validator[]