From e886d671c107e60dace988f08823738072149437 Mon Sep 17 00:00:00 2001 From: Tchama Date: Wed, 15 Jul 2020 16:00:59 +0200 Subject: [PATCH] deprecated: fix PersonRepository location --- Entity/PersonRepository.php | 33 ---------------------------- Repository/PersonRepository.php | 39 +++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 37 deletions(-) delete mode 100644 Entity/PersonRepository.php diff --git a/Entity/PersonRepository.php b/Entity/PersonRepository.php deleted file mode 100644 index b8f121a1b..000000000 --- a/Entity/PersonRepository.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -namespace Chill\PersonBundle\Entity; - -use Doctrine\ORM\EntityRepository; - -@trigger_error(__CLASS__." is deprecated since 2019-10-30. Use " - .\Chill\PersonBundle\Repository\PersonRepository::class.' instead.', - E_USER_DEPRECATED); - -/** - * - * @deprecated since 2019-10-30. Use \Chill\PersonBundle\Repository\PersonRepository instead. - */ -class PersonRepository extends EntityRepository -{ -} diff --git a/Repository/PersonRepository.php b/Repository/PersonRepository.php index 42294ac2e..ccc56b639 100644 --- a/Repository/PersonRepository.php +++ b/Repository/PersonRepository.php @@ -18,15 +18,25 @@ namespace Chill\PersonBundle\Repository; - +use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; /** - * PersonRepository + * Class PersonRepository * + * @package Chill\PersonBundle\Repository */ -class PersonRepository extends \Chill\PersonBundle\Entity\PersonRepository +class PersonRepository extends EntityRepository { + /** + * @param string $phonenumber + * @param $centers + * @param $firstResult + * @param $maxResults + * @param array $only + * @return mixed + * @throws \Exception + */ public function findByPhone( string $phonenumber, $centers, @@ -47,6 +57,14 @@ class PersonRepository extends \Chill\PersonBundle\Entity\PersonRepository return $qb->getQuery()->getResult(); } + /** + * @param string $phonenumber + * @param $centers + * @param array $only + * @return int + * @throws \Doctrine\ORM\NoResultException + * @throws \Doctrine\ORM\NonUniqueResultException + */ public function countByPhone( string $phonenumber, $centers, @@ -62,6 +80,12 @@ class PersonRepository extends \Chill\PersonBundle\Entity\PersonRepository return $qb->getQuery()->getSingleScalarResult(); } + /** + * @param QueryBuilder $qb + * @param string $phonenumber + * @param array $only + * @throws \Exception + */ protected function addPhoneNumber(QueryBuilder $qb, string $phonenumber, array $only) { if (count($only) === 0) { @@ -84,12 +108,19 @@ class PersonRepository extends \Chill\PersonBundle\Entity\PersonRepository $qb->setParameter('phonenumber', '%'.$phonenumber.'%'); } - + /** + * @param $phonenumber + * @return string + */ protected function parsePhoneNumber($phonenumber): string { return \str_replace(' ', '', $phonenumber); } + /** + * @param QueryBuilder $qb + * @param array $centers + */ protected function addByCenters(QueryBuilder $qb, array $centers) { if (count($centers) > 0) {