Relacion basica

This commit is contained in:
2020-01-21 14:58:52 -03:00
parent ccaf1fc5bc
commit c11d479cd7

View File

@ -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);
}
}