From f67ad7ab982af00389fc7985c1a23044b31e53b7 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 11 Jun 2015 18:42:49 +0930 Subject: [PATCH] API: Reorder Extend\Relationship arguments --- framework/core/src/Extend/Relationship.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/framework/core/src/Extend/Relationship.php b/framework/core/src/Extend/Relationship.php index de16a6724..c002b1395 100644 --- a/framework/core/src/Extend/Relationship.php +++ b/framework/core/src/Extend/Relationship.php @@ -7,17 +7,19 @@ class Relationship implements ExtenderInterface { protected $parent; - protected $type; - protected $name; + protected $type; + protected $child; - public function __construct($parent, $type, $name, $child = null) + protected $table; + + public function __construct($parent, $name, $type, $child = null) { $this->parent = $parent; - $this->type = $type; $this->name = $name; + $this->type = $type; $this->child = $child; } @@ -30,6 +32,8 @@ class Relationship implements ExtenderInterface return call_user_func($this->type, $model); } elseif ($this->type === 'belongsTo') { return $model->belongsTo($this->child, null, null, $this->name); + } elseif ($this->type === 'belongsToMany') { + return $model->belongsToMany($this->child, $this->table, null, null, $this->name); } else { // @todo }