fix exceptions
This commit is contained in:
@@ -292,7 +292,7 @@ class RDBRelation
|
||||
protected function processCheckForeignEntity(Entity $entity)
|
||||
{
|
||||
if ($this->foreignEntityType && $this->foreignEntityType !== $entity->getEntityType()) {
|
||||
throw new InvalidArgumentException("Entity type doesn't match an entity type of the relation.");
|
||||
throw new RuntimeException("Entity type doesn't match an entity type of the relation.");
|
||||
}
|
||||
|
||||
if (!$entity->id) {
|
||||
@@ -370,7 +370,7 @@ class RDBRelation
|
||||
}
|
||||
|
||||
if ($id === '') {
|
||||
throw new InvalidArgumentException();
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
$seed = $this->entityManager->getEntityFactory()->create($this->foreignEntityType);
|
||||
@@ -389,7 +389,7 @@ class RDBRelation
|
||||
}
|
||||
|
||||
if ($id === '') {
|
||||
throw new InvalidArgumentException();
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
$seed = $this->entityManager->getEntityFactory()->create($this->foreignEntityType);
|
||||
@@ -408,7 +408,7 @@ class RDBRelation
|
||||
}
|
||||
|
||||
if ($id === '') {
|
||||
throw new InvalidArgumentException();
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
$seed = $this->entityManager->getEntityFactory()->create($this->foreignEntityType);
|
||||
|
||||
@@ -40,7 +40,6 @@ use Espo\ORM\{
|
||||
};
|
||||
|
||||
use RuntimeException;
|
||||
use BadMethodCallException;
|
||||
|
||||
/**
|
||||
* Builds select parameters for related records for RDB repository.
|
||||
|
||||
@@ -41,7 +41,6 @@ use Espo\ORM\{
|
||||
|
||||
use StdClass;
|
||||
use RuntimeException;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class RDBRepository extends Repository
|
||||
{
|
||||
@@ -232,7 +231,7 @@ class RDBRepository extends Repository
|
||||
$params = $params ?? [];
|
||||
|
||||
if ($entity->getEntityType() !== $this->entityType) {
|
||||
throw new InvalidArgumentException("Not supported entity type.");
|
||||
throw new RuntimeException("Not supported entity type.");
|
||||
}
|
||||
|
||||
if (!$entity->id) {
|
||||
@@ -283,7 +282,7 @@ class RDBRepository extends Repository
|
||||
$params = $params ?? [];
|
||||
|
||||
if ($entity->getEntityType() !== $this->entityType) {
|
||||
throw new InvalidArgumentException("Not supported entity type.");
|
||||
throw new RuntimeException("Not supported entity type.");
|
||||
}
|
||||
|
||||
if (!$entity->id) {
|
||||
@@ -373,7 +372,7 @@ class RDBRepository extends Repository
|
||||
}
|
||||
|
||||
if ($entity->getEntityType() !== $this->entityType) {
|
||||
throw new InvalidArgumentException("Not supported entity type.");
|
||||
throw new RuntimeException("Not supported entity type.");
|
||||
}
|
||||
|
||||
if ($foreign instanceof Entity) {
|
||||
@@ -421,7 +420,7 @@ class RDBRepository extends Repository
|
||||
}
|
||||
|
||||
if ($entity->getEntityType() !== $this->entityType) {
|
||||
throw new InvalidArgumentException("Not supported entity type.");
|
||||
throw new RuntimeException("Not supported entity type.");
|
||||
}
|
||||
|
||||
$this->beforeRelate($entity, $relationName, $foreign, $columnData, $options);
|
||||
@@ -478,7 +477,7 @@ class RDBRepository extends Repository
|
||||
}
|
||||
|
||||
if ($entity->getEntityType() !== $this->entityType) {
|
||||
throw new InvalidArgumentException("Not supported entity type.");
|
||||
throw new RuntimeException("Not supported entity type.");
|
||||
}
|
||||
|
||||
$this->beforeUnrelate($entity, $relationName, $foreign, $options);
|
||||
|
||||
Reference in New Issue
Block a user