From d3c86b2932da8f8fcaf65c3d561387c42bc2501d Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sat, 19 Apr 2025 12:29:40 -0400 Subject: [PATCH] Update docs for cakephp/cakephp#18354 --- en/appendices/5-3-migration-guide.rst | 1 + en/orm/entities.rst | 7 +------ fr/orm/entities.rst | 8 +------- ja/orm/entities.rst | 5 +---- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/en/appendices/5-3-migration-guide.rst b/en/appendices/5-3-migration-guide.rst index f9877f1b75..7c928f31ef 100644 --- a/en/appendices/5-3-migration-guide.rst +++ b/en/appendices/5-3-migration-guide.rst @@ -37,6 +37,7 @@ ORM - Calling behavior methods on table instances is now deprecated. To call a method of an attached behavior you need to use ``$table->getBehavior('Sluggable')->slugify()`` instead of ``$table->slugify()``. +- ``EntityTrait::isEmpty()`` is deprecated. Use ``hasValue()`` instead. New Features ============ diff --git a/en/orm/entities.rst b/en/orm/entities.rst index f2a257b987..3b307f0e18 100644 --- a/en/orm/entities.rst +++ b/en/orm/entities.rst @@ -132,8 +132,7 @@ You can check if fields are defined in your entities with ``has()``:: $article->has('undefined'); // false The ``has()`` method will return ``true`` if a field is defined. You can use -``isEmpty()`` and ``hasValue()`` to check if a field contains a 'non-empty' -value:: +``hasValue()`` to check if a field contains a 'non-empty' value:: $article = new Article([ 'title' => 'First post', @@ -142,19 +141,15 @@ value:: 'links' => [], ]); $article->has('title'); // true - $article->isEmpty('title'); // false $article->hasValue('title'); // true $article->has('user_id'); // true - $article->isEmpty('user_id'); // true $article->hasValue('user_id'); // false $article->has('text'); // true - $article->isEmpty('text'); // true $article->hasValue('text'); // false $article->has('links'); // true - $article->isEmpty('links'); // true $article->hasValue('links'); // false If you often partially load entities you should enable strict-property access diff --git a/fr/orm/entities.rst b/fr/orm/entities.rst index 6edc6b3eb4..789ece0430 100644 --- a/fr/orm/entities.rst +++ b/fr/orm/entities.rst @@ -136,7 +136,7 @@ Vous pouvez vérifier si des champs sont définis dans vos entities avec $article->has('undefined'); // false. La méthode ``has()`` va renvoyer ``true`` si un champ est défini est a une -valeur non null. Vous pouvez utiliser ``isEmpty()`` et ``hasValue()`` pour +valeur non null. Vous pouvez utiliser ``hasValue()`` pour vérifier si un champ contient une valeur 'non-empty':: $article = new Article([ @@ -147,27 +147,21 @@ vérifier si un champ contient une valeur 'non-empty':: ]); ]); $article->has('title'); // true - $article->isEmpty('title'); // false $article->hasValue('title'); // true $article->has('user_id'); // true - $article->isEmpty('user_id'); // true $article->hasValue('user_id'); // false $article->has('text'); // true - $article->isEmpty('text'); // true $article->hasValue('text'); // false $article->has('links'); // true - $article->isEmpty('links'); // true $article->hasValue('links'); // false $article->has('text'); // true - $article->isEmpty('text'); // true $article->hasValue('text'); // false $article->has('links'); // true - $article->isEmpty('links'); // true $article->hasValue('links'); // false Accesseurs & Mutateurs diff --git a/ja/orm/entities.rst b/ja/orm/entities.rst index 7ff2db1dda..da90f25645 100644 --- a/ja/orm/entities.rst +++ b/ja/orm/entities.rst @@ -109,17 +109,14 @@ CakePHP の ORM を使うためにエンティティークラスを生成する $article->has('undefined'); // false. ``has()`` メソッドは、プロパティが定義されていてヌル以外の値を持つ場合、 ``true`` を返します。 -``isEmpty()`` と ``hasValue()`` を使って、プロパティに '空でない' 値が含まれているかどうかを +``hasValue()`` を使って、プロパティに '空でない' 値が含まれているかどうかを 調べることができます。 :: $article = new Article([ 'title' => 'First post', 'user_id' => null ]); - $article->isEmpty('title'); // false $article->hasValue('title'); // true - - $article->isEmpty('user_id'); // true $article->hasValue('user_id'); // false アクセサーとミューテーター