aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/namespace/Item.php13
-rw-r--r--core/namespace/ItemInterface.php2
2 files changed, 13 insertions, 2 deletions
diff --git a/core/namespace/Item.php b/core/namespace/Item.php
index 60f7547..ba54579 100644
--- a/core/namespace/Item.php
+++ b/core/namespace/Item.php
@@ -10,7 +10,7 @@ abstract class Item implements ItemInterface {
#===============================================================================
# Abstract item constructor
#===============================================================================
- public final function __construct($itemID, \Database $Database) {
+ public final function __construct($param, \Database $Database) {
$this->Database = $Database;
$this->Reflection = new ReflectionObject($this);
@@ -18,6 +18,17 @@ abstract class Item implements ItemInterface {
$attribute = "{$this->Reflection->getNamespaceName()}\\Attribute";
$exception = "{$this->Reflection->getNamespaceName()}\\Exception";
+ # If $param is an instance of Attribute,
+ # skip fetching attribute from database!
+ if($param instanceof Attribute) {
+ $this->Attribute = $param;
+ return;
+ }
+
+ # If this gets executed, then $param
+ # is not an instance of Attribute!
+ $itemID = $param;
+
#===============================================================================
# Checking if item in database exists
#===============================================================================
diff --git a/core/namespace/ItemInterface.php b/core/namespace/ItemInterface.php
index e7ccb6a..f2ba12d 100644
--- a/core/namespace/ItemInterface.php
+++ b/core/namespace/ItemInterface.php
@@ -1,5 +1,5 @@
<?php
interface ItemInterface {
- public function __construct($itemID, \Database $Database);
+ public function __construct($param, \Database $Database);
}
?> \ No newline at end of file