From fb0980a1d3380c35637f0bcb28571f258e40d386 Mon Sep 17 00:00:00 2001 From: inoas Date: Fri, 4 Aug 2017 14:10:58 +0200 Subject: [PATCH 1/5] Educate bout accessors being run before persisting Ref: https://github.com/cakephp/cakephp/issues/10993#issuecomment-319984886 @markstory Let me know if this is not 100% correct... then I will fix it. --- en/orm/entities.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/en/orm/entities.rst b/en/orm/entities.rst index 6aa19307b7..80e3585c6c 100644 --- a/en/orm/entities.rst +++ b/en/orm/entities.rst @@ -166,6 +166,14 @@ ways:: $user->title = 'foo'; // slug is set as well $user->set('title', 'foo'); // slug is set as well + + +.. note:: + + Accessor are also being run before entities are being persisted to the database. + If you want to transform fields but not persist that transformation, + we recommend using virtual properties as those are not persisted. + .. _entities-virtual-properties: Creating Virtual Properties From 7b227fd2ae990338c0107ca2f9a9c06a58e1bff9 Mon Sep 17 00:00:00 2001 From: inoas Date: Fri, 4 Aug 2017 14:11:23 +0200 Subject: [PATCH 2/5] Update entities.rst --- en/orm/entities.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/en/orm/entities.rst b/en/orm/entities.rst index 80e3585c6c..c1380d93ec 100644 --- a/en/orm/entities.rst +++ b/en/orm/entities.rst @@ -166,8 +166,6 @@ ways:: $user->title = 'foo'; // slug is set as well $user->set('title', 'foo'); // slug is set as well - - .. note:: Accessor are also being run before entities are being persisted to the database. From c67be820df5efcbc3a1d9d19d6f2d4eb0eaffa71 Mon Sep 17 00:00:00 2001 From: inoas Date: Fri, 4 Aug 2017 15:38:11 +0200 Subject: [PATCH 3/5] note -> warning, plural --- en/orm/entities.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/orm/entities.rst b/en/orm/entities.rst index c1380d93ec..6bc1c0a5b1 100644 --- a/en/orm/entities.rst +++ b/en/orm/entities.rst @@ -166,9 +166,9 @@ ways:: $user->title = 'foo'; // slug is set as well $user->set('title', 'foo'); // slug is set as well -.. note:: +.. warning:: - Accessor are also being run before entities are being persisted to the database. + Accessors are also being run before entities are being persisted to the database. If you want to transform fields but not persist that transformation, we recommend using virtual properties as those are not persisted. From 86f6a1a322dccefa347e9973f811350f365f0ed3 Mon Sep 17 00:00:00 2001 From: inoas Date: Fri, 4 Aug 2017 16:40:04 +0200 Subject: [PATCH 4/5] remove superfluous 'being' --- en/orm/entities.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/orm/entities.rst b/en/orm/entities.rst index 6bc1c0a5b1..d0b785c2db 100644 --- a/en/orm/entities.rst +++ b/en/orm/entities.rst @@ -168,7 +168,7 @@ ways:: .. warning:: - Accessors are also being run before entities are being persisted to the database. + Accessors are also run before entities are being persisted to the database. If you want to transform fields but not persist that transformation, we recommend using virtual properties as those are not persisted. From 7d7f15f92aa30952caac0ee0c32c437c450af72e Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sun, 6 Aug 2017 21:11:49 -0400 Subject: [PATCH 5/5] Grammar fix. --- en/orm/entities.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/orm/entities.rst b/en/orm/entities.rst index d0b785c2db..dc705399d4 100644 --- a/en/orm/entities.rst +++ b/en/orm/entities.rst @@ -168,7 +168,7 @@ ways:: .. warning:: - Accessors are also run before entities are being persisted to the database. + Accessors are also run before entities are persisted to the database. If you want to transform fields but not persist that transformation, we recommend using virtual properties as those are not persisted.