Skip to content

Commit

Permalink
#220 Where appropriate, use an InvalidArgumentException (instead of j…
Browse files Browse the repository at this point in the history
…ust Exception)
  • Loading branch information
extracts committed Feb 11, 2022
1 parent 0218da4 commit d08cdd3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/Opus/Db2/CollectionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
namespace Opus\Db2;

use Doctrine\ORM\ORMException;
use Exception;
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
use InvalidArgumentException;
use Opus\Model2\Collection;

class CollectionRepository extends NestedTreeRepository
Expand All @@ -60,7 +60,7 @@ public function getAll()
public function fetchCollectionsByRoleId($roleId, $sortResults = false)
{
if (! isset($roleId)) {
throw new Exception("Parameter 'roleId' is required.");
throw new InvalidArgumentException("Parameter 'roleId' is required.");
}

$queryBuilder = $this->getEntityManager()->createQueryBuilder();
Expand Down Expand Up @@ -91,11 +91,11 @@ public function fetchCollectionsByRoleId($roleId, $sortResults = false)
public function fetchCollectionsByRoleName($roleId, $name)
{
if (! isset($roleId)) {
throw new Exception("Parameter 'roleId' is required.");
throw new InvalidArgumentException("Parameter 'roleId' is required.");
}

if (! isset($name)) {
throw new Exception("Parameter 'name' is required.");
throw new InvalidArgumentException("Parameter 'name' is required.");
}

$queryBuilder = $this->getEntityManager()->createQueryBuilder();
Expand All @@ -122,7 +122,7 @@ public function fetchCollectionsByRoleName($roleId, $name)
public function fetchChildrenByParentId($parentId, $sortResults = false)
{
if (! isset($parentId)) {
throw new Exception("Parameter 'parentId' is required.");
throw new InvalidArgumentException("Parameter 'parentId' is required.");
}

$queryBuilder = $this->getEntityManager()->createQueryBuilder();
Expand Down

0 comments on commit d08cdd3

Please sign in to comment.