Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions en/appendices/5-3-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
============
Expand Down
7 changes: 1 addition & 6 deletions en/orm/entities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down
8 changes: 1 addition & 7 deletions fr/orm/entities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions ja/orm/entities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

アクセサーとミューテーター
Expand Down