diff --git a/src/ORM/HasMany.php b/src/ORM/HasMany.php deleted file mode 100644 index a8a422f..0000000 --- a/src/ORM/HasMany.php +++ /dev/null @@ -1,21 +0,0 @@ -foreignObject = $foreignObject; - $this->remoteField = $remoteField; - $this->localElement = $localElement; - } - - function get() { - return $this->foreignObject::findMany(Array($this->remoteField => Array('=', $this->localElement->id))); - } - -} diff --git a/src/ORM/HasOne.php b/src/ORM/HasOne.php deleted file mode 100644 index 23996eb..0000000 --- a/src/ORM/HasOne.php +++ /dev/null @@ -1,22 +0,0 @@ -foreignObject = $foreignObject; - $this->remoteField = $remoteField; - $this->localElement = $localElement; - } - - function get(){ - return $this->foreignObject::findOne(Array($this->remoteField => Array('=', $this->localElement->id))); - } - -} diff --git a/src/ORM/BelongsTo.php b/src/ORM/Relations/BelongsTo.php similarity index 65% rename from src/ORM/BelongsTo.php rename to src/ORM/Relations/BelongsTo.php index bc48f27..a605fb2 100644 --- a/src/ORM/BelongsTo.php +++ b/src/ORM/Relations/BelongsTo.php @@ -1,7 +1,19 @@ localObject = $localObject; $this->foreignObject = $foreignObject; diff --git a/src/ORM/BelongsToManyExtended.php b/src/ORM/Relations/BelongsToManyExtended.php similarity index 93% rename from src/ORM/BelongsToManyExtended.php rename to src/ORM/Relations/BelongsToManyExtended.php index f0c7e00..369a71b 100644 --- a/src/ORM/BelongsToManyExtended.php +++ b/src/ORM/Relations/BelongsToManyExtended.php @@ -1,6 +1,9 @@ foreignObject = $foreignObject; + $this->remoteField = $remoteField; + $this->localElement = $localElement; + } + + /** + * Get the data of the relation + */ + function get() + { + return $this->foreignObject::findMany(array($this->remoteField => array('=', $this->localElement->id))); + } + +} diff --git a/src/ORM/Relations/HasOne.php b/src/ORM/Relations/HasOne.php new file mode 100644 index 0000000..484d751 --- /dev/null +++ b/src/ORM/Relations/HasOne.php @@ -0,0 +1,35 @@ +foreignObject = $foreignObject; + $this->remoteField = $remoteField; + $this->localElement = $localElement; + } + + function get() + { + return $this->foreignObject::findOne(array($this->remoteField => array('=', $this->localElement->id))); + } + +}