diff --git a/common/Alias/Model.php b/common/Alias/Model.php index 29f1da7..5774de9 100644 --- a/common/Alias/Model.php +++ b/common/Alias/Model.php @@ -144,9 +144,11 @@ abstract class Model extends BaseModel implements ModelInterface { return $this->toArray(); } - public function setRelationship(string $class_name): Relationship { + public function setRelationship(string $class_name, string $relation_key, string $self_key): Relationship { return (new Relationship) ->setFactory($this->container->get('model')) - ->setStart($class_name); + ->setStart($class_name) + ->with($class_name, $relation_key, get_called_class(), $self_key) + ->setCondition(get_called_class(), $self_key, $this->$self_key); } }