1
0
mirror of https://github.com/flarum/core.git synced 2025-07-23 17:51:24 +02:00

API: Reorder Extend\Relationship arguments

This commit is contained in:
Toby Zerner
2015-06-11 18:42:49 +09:30
parent b6306efe01
commit f67ad7ab98

View File

@@ -7,17 +7,19 @@ class Relationship implements ExtenderInterface
{ {
protected $parent; protected $parent;
protected $type;
protected $name; protected $name;
protected $type;
protected $child; protected $child;
public function __construct($parent, $type, $name, $child = null) protected $table;
public function __construct($parent, $name, $type, $child = null)
{ {
$this->parent = $parent; $this->parent = $parent;
$this->type = $type;
$this->name = $name; $this->name = $name;
$this->type = $type;
$this->child = $child; $this->child = $child;
} }
@@ -30,6 +32,8 @@ class Relationship implements ExtenderInterface
return call_user_func($this->type, $model); return call_user_func($this->type, $model);
} elseif ($this->type === 'belongsTo') { } elseif ($this->type === 'belongsTo') {
return $model->belongsTo($this->child, null, null, $this->name); 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 { } else {
// @todo // @todo
} }