diff options
author | Thomas Lange <code@nerdmind.de> | 2021-08-10 17:42:11 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-08-10 19:41:49 +0200 |
commit | e3f05b25f961e0169185acabd32566e2ae5198fe (patch) | |
tree | 8c60ddc5d558983ad3bf4b20ca643b109410082b /core/namespace/ORM/Entities | |
parent | 49f03ac48efcce79822bed1ec40ad48bf5c6e450 (diff) | |
download | blog-e3f05b25f961e0169185acabd32566e2ae5198fe.tar.gz blog-e3f05b25f961e0169185acabd32566e2ae5198fe.tar.xz blog-e3f05b25f961e0169185acabd32566e2ae5198fe.zip |
Add a better mechanism to detect Entity changes
Implement and use a better mechanism to detect changes of attributes of
the Entity objects by using a private variable which keeps track of the
changed Entity attributes ("properties") via the "set" method.
The "insert" and "update" method of the Repository now calls the method
"getModifiedKeys" of the Entity class to get a list of properties which
have been changed and builds the database query accordingly.
This makes the use of "FALSE" as default value for the Entity attributes
obsolete, so they have been set to the initial PHP default ("NULL").
Diffstat (limited to 'core/namespace/ORM/Entities')
-rw-r--r-- | core/namespace/ORM/Entities/Category.php | 10 | ||||
-rw-r--r-- | core/namespace/ORM/Entities/Page.php | 10 | ||||
-rw-r--r-- | core/namespace/ORM/Entities/Post.php | 12 | ||||
-rw-r--r-- | core/namespace/ORM/Entities/User.php | 14 |
4 files changed, 23 insertions, 23 deletions
diff --git a/core/namespace/ORM/Entities/Category.php b/core/namespace/ORM/Entities/Category.php index cf3ca5f..e8c4496 100644 --- a/core/namespace/ORM/Entities/Category.php +++ b/core/namespace/ORM/Entities/Category.php @@ -3,9 +3,9 @@ namespace ORM\Entities; use ORM\Entity; class Category extends Entity { - protected $parent = FALSE; - protected $slug = FALSE; - protected $name = FALSE; - protected $body = FALSE; - protected $argv = FALSE; + protected $parent; + protected $slug; + protected $name; + protected $body; + protected $argv; } diff --git a/core/namespace/ORM/Entities/Page.php b/core/namespace/ORM/Entities/Page.php index 96ff233..1a65c01 100644 --- a/core/namespace/ORM/Entities/Page.php +++ b/core/namespace/ORM/Entities/Page.php @@ -3,9 +3,9 @@ namespace ORM\Entities; use ORM\Entity; class Page extends Entity { - protected $user = FALSE; - protected $slug = FALSE; - protected $name = FALSE; - protected $body = FALSE; - protected $argv = FALSE; + protected $user; + protected $slug; + protected $name; + protected $body; + protected $argv; } diff --git a/core/namespace/ORM/Entities/Post.php b/core/namespace/ORM/Entities/Post.php index 6a52a1f..8403a65 100644 --- a/core/namespace/ORM/Entities/Post.php +++ b/core/namespace/ORM/Entities/Post.php @@ -3,10 +3,10 @@ namespace ORM\Entities; use ORM\Entity; class Post extends Entity { - protected $user = FALSE; - protected $category = FALSE; - protected $slug = FALSE; - protected $name = FALSE; - protected $body = FALSE; - protected $argv = FALSE; + protected $user; + protected $category; + protected $slug; + protected $name; + protected $body; + protected $argv; } diff --git a/core/namespace/ORM/Entities/User.php b/core/namespace/ORM/Entities/User.php index 65d5345..78e03db 100644 --- a/core/namespace/ORM/Entities/User.php +++ b/core/namespace/ORM/Entities/User.php @@ -3,11 +3,11 @@ namespace ORM\Entities; use ORM\Entity; class User extends Entity { - protected $slug = FALSE; - protected $username = FALSE; - protected $password = FALSE; - protected $fullname = FALSE; - protected $mailaddr = FALSE; - protected $body = FALSE; - protected $argv = FALSE; + protected $slug; + protected $username; + protected $password; + protected $fullname; + protected $mailaddr; + protected $body; + protected $argv; } |