|
@@ -24,11 +24,21 @@ abstract class Relationship extends Query {
|
|
{
|
|
{
|
|
$this->foreign = $foreign;
|
|
$this->foreign = $foreign;
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- $this->model = ($associated instanceof Model) ? $associated : new $associated;
|
|
+ if ($associated instanceof Model)
|
|
|
|
+ {
|
|
|
|
+ $this->model = $associated;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ $this->model = new $associated;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
if ($model instanceof Model)
|
|
if ($model instanceof Model)
|
|
{
|
|
{
|
|
$this->base = $model;
|
|
$this->base = $model;
|
|
@@ -38,9 +48,9 @@ abstract class Relationship extends Query {
|
|
$this->base = new $model;
|
|
$this->base = new $model;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
$this->table = $this->query();
|
|
$this->table = $this->query();
|
|
|
|
|
|
$this->constrain();
|
|
$this->constrain();
|