aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2018-04-01 16:11:01 +0200
committerThomas Lange <code@nerdmind.de>2018-04-01 16:11:01 +0200
commit1da2c1e38a3b47840243b2021b41130ac667eba5 (patch)
tree6936afa3946e2efcccadd45c1671939688e748e4 /core
parente3aec30a7ccbe5774160cfb6399abb9d33900c98 (diff)
downloadblog-1da2c1e38a3b47840243b2021b41130ac667eba5.tar.gz
blog-1da2c1e38a3b47840243b2021b41130ac667eba5.tar.xz
blog-1da2c1e38a3b47840243b2021b41130ac667eba5.zip
Add method "getUserAttribute" to Page and Post class
Diffstat (limited to 'core')
-rw-r--r--core/namespace/Page/Item.php8
-rw-r--r--core/namespace/Post/Item.php8
2 files changed, 16 insertions, 0 deletions
diff --git a/core/namespace/Page/Item.php b/core/namespace/Page/Item.php
index e3bf6a3..4206f2f 100644
--- a/core/namespace/Page/Item.php
+++ b/core/namespace/Page/Item.php
@@ -39,5 +39,13 @@ class Item extends \Item {
return [];
}
+
+ #===============================================================================
+ # Return associated User\Attribute
+ #===============================================================================
+ public function getUserAttribute() {
+ $Statement = $this->Database->query(sprintf('SELECT * FROM user WHERE id = %d', $this->Attribute->get('user')));
+ return $Statement->fetchObject('User\Attribute');
+ }
}
?> \ No newline at end of file
diff --git a/core/namespace/Post/Item.php b/core/namespace/Post/Item.php
index a269ce4..d5b7f2e 100644
--- a/core/namespace/Post/Item.php
+++ b/core/namespace/Post/Item.php
@@ -46,5 +46,13 @@ class Item extends \Item {
return [];
}
+
+ #===============================================================================
+ # Return associated User\Attribute
+ #===============================================================================
+ public function getUserAttribute() {
+ $Statement = $this->Database->query(sprintf('SELECT * FROM user WHERE id = %d', $this->Attribute->get('user')));
+ return $Statement->fetchObject('User\Attribute');
+ }
}
?> \ No newline at end of file