Skip to content
Permalink
Browse files

refactor: Added missing use statements + clean up for non related exc…

…eptions.
  • Loading branch information...
tarlepp committed Jul 5, 2019
1 parent 274c4b2 commit 07ee57565ebeff118d019d7eae4e47cc27b80bcd
Showing with 20 additions and 17 deletions.
  1. +20 −17 src/Repository/Traits/RepositoryMethodsTrait.php
@@ -13,8 +13,14 @@
use App\Rest\RepositoryHelper;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\ORMException;
use Doctrine\ORM\ORMInvalidArgumentException;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Tools\Pagination\Paginator;
use Doctrine\ORM\TransactionRequiredException;
use InvalidArgumentException;
use function array_map;
use function array_values;
@@ -41,10 +47,10 @@ trait RepositoryMethodsTrait
*
* @return EntityInterface|mixed|null
*
* @throws \Doctrine\ORM\TransactionRequiredException
* @throws \Doctrine\ORM\OptimisticLockException
* @throws \Doctrine\ORM\ORMInvalidArgumentException
* @throws \Doctrine\ORM\ORMException
* @throws TransactionRequiredException
* @throws OptimisticLockException
* @throws ORMInvalidArgumentException
* @throws ORMException
*/
public function find(string $id, ?int $lockMode = null, ?int $lockVersion = null)
{
@@ -57,15 +63,12 @@ public function find(string $id, ?int $lockMode = null, ?int $lockVersion = null
* Advanced version of find method, with this you can process query as you like, eg. add joins and callbacks to
* modify / optimize current query.
*
* @psalm-suppress LessSpecificImplementedReturnType
*
* @param string $id
* @param string|int $hydrationMode
*
* @return array<int|string, mixed>|EntityInterface
*
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
* @throws NonUniqueResultException
*/
public function findAdvanced(string $id, $hydrationMode = null)
{
@@ -134,7 +137,7 @@ public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = nu
*
* @return array<EntityInterface>|EntityInterface[]
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
public function findByAdvanced(
array $criteria,
@@ -183,7 +186,7 @@ public function findAll(): array
*
* @return string[]
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
public function findIds(?array $criteria = null, ?array $search = null): array
{
@@ -217,8 +220,8 @@ public function findIds(?array $criteria = null, ?array $search = null): array
*
* @return int
*
* @throws \InvalidArgumentException
* @throws \Doctrine\ORM\NonUniqueResultException
* @throws InvalidArgumentException
* @throws NonUniqueResultException
*/
public function countAdvanced(?array $criteria = null, ?array $search = null): int
{
@@ -268,8 +271,8 @@ public function reset(): int
*
* @return BaseRepositoryInterface
*
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
* @throws ORMException
* @throws OptimisticLockException
*/
public function save(EntityInterface $entity, ?bool $flush = null): BaseRepositoryInterface
{
@@ -294,8 +297,8 @@ public function save(EntityInterface $entity, ?bool $flush = null): BaseReposito
*
* @return BaseRepositoryInterface
*
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
* @throws ORMException
* @throws OptimisticLockException
*/
public function remove(EntityInterface $entity, ?bool $flush = null): BaseRepositoryInterface
{
@@ -323,7 +326,7 @@ public function remove(EntityInterface $entity, ?bool $flush = null): BaseReposi
*
* @return QueryBuilder
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
private function getQueryBuilder(
?array $criteria = null,

0 comments on commit 07ee575

Please sign in to comment.
You can’t perform that action at this time.