This commit is contained in:
Yuri Kuznetsov
2020-08-17 13:49:20 +03:00
parent 2f0e0d2a3b
commit db03f4f408
3 changed files with 22 additions and 54 deletions
@@ -460,12 +460,12 @@ class RDBRepository extends Repository
}
if ($foreign instanceof Entity) {
$id = $foreign->id;
$result = $this->getMapper()->relate($entity, $relationName, $foreign, $data);
} else {
$id = $foreign;
}
$result = $this->getMapper()->relateById($entity, $relationName, $id, $data);
$result = $this->getMapper()->relateById($entity, $relationName, $id, $data);
}
}
if ($result) {
@@ -511,12 +511,11 @@ class RDBRepository extends Repository
$result = $this->$methodName($entity, $foreign);
} else {
if ($foreign instanceof Entity) {
$id = $foreign->id;
$result = $this->getMapper()->unrelate($entity, $relationName, $foreign);
} else {
$id = $foreign;
$result = $this->getMapper()->unrelateById($entity, $relationName, $id);
}
$result = $this->getMapper()->unrelateById($entity, $relationName, $id);
}
if ($result) {