From 1da2c1e38a3b47840243b2021b41130ac667eba5 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sun, 1 Apr 2018 16:11:01 +0200 Subject: Add method "getUserAttribute" to Page and Post class --- core/namespace/Post/Item.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/namespace/Post') 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 -- cgit v1.2.3