deprecated: fix PersonRepository location

This commit is contained in:
Tchama 2020-07-15 16:00:59 +02:00
parent 7060fc2e6a
commit e886d671c1
2 changed files with 35 additions and 37 deletions

View File

@ -1,33 +0,0 @@
<?php
/*
* Copyright (C) 2014-2019 Julien Fastré <julien.fastre@champs-libres.coop>
*
* 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 <http://www.gnu.org/licenses/>.
*/
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
{
}

View File

@ -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) {