replace some entity shortcut by fqdn

* ChillPerson:Person
* ChillMain:Center
* ChillActivity:Activity
This commit is contained in:
Julien Fastré 2022-04-30 00:20:18 +02:00
parent 8ba51bafd0
commit a0392b9216
29 changed files with 61 additions and 60 deletions

View File

@ -221,7 +221,7 @@ final class ActivityControllerTest extends WebTestCase
}
//create groupCenter
$groupCenter = new \Chill\MainBundle\Entity\GroupCenter();
$groupCenter->setCenter($em->getRepository('ChillMainBundle:Center')
$groupCenter->setCenter($em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']))
->setPermissionsGroup($withoutActivityPermissionGroup);
$em->persist($withoutActivityPermissionGroup);
@ -249,7 +249,7 @@ final class ActivityControllerTest extends WebTestCase
$em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$activities = $em->getRepository('ChillActivityBundle:Activity')
$activities = $em->getRepository(\Chill\ActivityBundle\Entity\Activity::class)
->findBy(['person' => $person]);
if (count($activities) === 0) {
@ -281,7 +281,7 @@ final class ActivityControllerTest extends WebTestCase
$em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$person = $em->getRepository('ChillPersonBundle:Person')
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy([
'firstName' => 'Depardieu',
'lastName' => 'Gérard',
@ -339,7 +339,7 @@ final class ActivityControllerTest extends WebTestCase
{
$user = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User')
->getRepository(\Chill\MainBundle\Entity\User::class)
->findOneByUsername($username);
if (null === $user) {
@ -349,7 +349,7 @@ final class ActivityControllerTest extends WebTestCase
$center = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:Center')
->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneByName($centerName);
// get scope reachable by both role UPDATE and DELETE

View File

@ -68,10 +68,10 @@ final class ActivityTypeTest extends KernelTestCase
->push($request);
$this->user = $this->container->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User')
->getRepository(\Chill\MainBundle\Entity\User::class)
->findOneBy(['username' => 'center a_social']);
$this->center = $this->container->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:Center')
->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$token = $prophet->prophesize();
$token->willExtend(AbstractToken::class);

View File

@ -178,7 +178,7 @@ class EventController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
if (null === $person) {
throw $this->createNotFoundException('Person not found');

View File

@ -598,7 +598,7 @@ class ParticipationController extends AbstractController
$participation = count($persons_ids) > 1 ? clone $participation : $participation;
if (null !== $person_id) {
$person = $em->getRepository('ChillPersonBundle:Person')
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
if (null === $person) {

View File

@ -15,6 +15,7 @@ use Chill\EventBundle\Entity\Event;
use Chill\EventBundle\Entity\Participation;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Chill\MainBundle\Entity\Center;
use Chill\PersonBundle\Entity\Person;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
@ -64,11 +65,11 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
public function load(ObjectManager $manager)
{
$centers = $manager->getRepository('ChillMainBundle:Center')
$centers = $manager->getRepository(Center::class)
->findAll();
foreach ($centers as $center) {
$people = $manager->getRepository('ChillPersonBundle:Person')
$people = $manager->getRepository(Person::class)
->findBy(['center' => $center]);
$events = $this->createEvents($center, $manager);

View File

@ -453,7 +453,7 @@ final class ParticipationControllerTest extends WebTestCase
*/
protected function getRandomEvent($centerName = 'Center A', $circleName = 'social')
{
$center = $this->em->getRepository('ChillMainBundle:Center')
$center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findByName($centerName);
$circles = $this->em->getRepository('ChillMainBundle:Scope')
@ -503,10 +503,10 @@ final class ParticipationControllerTest extends WebTestCase
*/
protected function getRandomPerson($centerName = 'Center A')
{
$center = $this->em->getRepository('ChillMainBundle:Center')
$center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findByName($centerName);
$persons = $this->em->getRepository('ChillPersonBundle:Person')
$persons = $this->em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findBy(['center' => $center]);
$person = $persons[array_rand($persons)];

View File

@ -86,7 +86,7 @@ final class EventSearchTest extends WebTestCase
->get('doctrine.orm.entity_manager');
$this->centerA = $this->entityManager
->getRepository('ChillMainBundle:Center')
->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$this->eventType = $this->entityManager

View File

@ -43,7 +43,7 @@ class SetPasswordCommand extends Command
public function _getUser($username)
{
return $this->entityManager
->getRepository('ChillMainBundle:User')
->getRepository(\Chill\MainBundle\Entity\User::class)
->findOneBy(['username' => $username]);
}

View File

@ -54,7 +54,7 @@ class CenterController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$center = $em->getRepository('ChillMainBundle:Center')->find($id);
$center = $em->getRepository(\Chill\MainBundle\Entity\Center::class)->find($id);
if (!$center) {
throw $this->createNotFoundException('Unable to find Center entity.');
@ -75,7 +75,7 @@ class CenterController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillMainBundle:Center')->findAll();
$entities = $em->getRepository(\Chill\MainBundle\Entity\Center::class)->findAll();
return $this->render('@ChillMain/Center/index.html.twig', [
'entities' => $entities,
@ -105,7 +105,7 @@ class CenterController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$center = $em->getRepository('ChillMainBundle:Center')->find($id);
$center = $em->getRepository(\Chill\MainBundle\Entity\Center::class)->find($id);
if (!$center) {
throw $this->createNotFoundException('Unable to find Center entity.');
@ -125,7 +125,7 @@ class CenterController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$center = $em->getRepository('ChillMainBundle:Center')->find($id);
$center = $em->getRepository(\Chill\MainBundle\Entity\Center::class)->find($id);
if (!$center) {
throw $this->createNotFoundException('Unable to find Center entity.');

View File

@ -61,7 +61,7 @@ class UserController extends CRUDController
{
$em = $this->getDoctrine()->getManager();
$user = $em->getRepository('ChillMainBundle:User')->find($uid);
$user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid);
if (!$user) {
throw $this->createNotFoundException('Unable to find User entity.');
@ -118,7 +118,7 @@ class UserController extends CRUDController
{
$em = $this->getDoctrine()->getManager();
$user = $em->getRepository('ChillMainBundle:User')->find($uid);
$user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid);
if (!$user) {
throw $this->createNotFoundException('Unable to find User entity.');

View File

@ -83,7 +83,7 @@ abstract class AbstractExportTest extends WebTestCase
$em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$centers = $em->getRepository('ChillMainBundle:Center')
$centers = $em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findAll();
$circles = $em->getRepository('ChillMainBundle:Scope')
->findAll();

View File

@ -161,7 +161,7 @@ final class UserControllerTest extends WebTestCase
$user = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User')
->getRepository(\Chill\MainBundle\Entity\User::class)
->findOneBy(['username' => $username]);
$this->assertTrue($passwordEncoder->isPasswordValid($user, $password));

View File

@ -672,7 +672,7 @@ final class ExportManagerTest extends KernelTestCase
$localUser = $user ?? self::$container->get(
'doctrine.orm.entity_manager'
)
->getRepository('ChillMainBundle:User')
->getRepository(\Chill\MainBundle\Entity\User::class)
->findOneBy(['username' => 'center a_social']);
$token = new UsernamePasswordToken($localUser, 'password', 'provider');
$tokenStorage = new TokenStorage();

View File

@ -451,7 +451,7 @@ class AccompanyingPeriodController extends AbstractController
private function _getPerson(int $id): Person
{
$person = $this->getDoctrine()->getManager()
->getRepository('ChillPersonBundle:Person')->find($id);
->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($id);
if (null === $person) {
throw $this->createNotFoundException('Person not found');

View File

@ -43,7 +43,7 @@ class PersonAddressController extends AbstractController
public function createAction($person_id, Request $request)
{
$person = $this->getDoctrine()->getManager()
->getRepository('ChillPersonBundle:Person')
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
if (null === $person) {
@ -98,7 +98,7 @@ class PersonAddressController extends AbstractController
public function editAction($person_id, $address_id)
{
$person = $this->getDoctrine()->getManager()
->getRepository('ChillPersonBundle:Person')
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
if (null === $person) {
@ -126,7 +126,7 @@ class PersonAddressController extends AbstractController
public function listAction($person_id)
{
$person = $this->getDoctrine()->getManager()
->getRepository('ChillPersonBundle:Person')
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
if (null === $person) {
@ -148,7 +148,7 @@ class PersonAddressController extends AbstractController
public function newAction($person_id)
{
$person = $this->getDoctrine()->getManager()
->getRepository('ChillPersonBundle:Person')
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
if (null === $person) {
@ -175,7 +175,7 @@ class PersonAddressController extends AbstractController
public function updateAction($person_id, $address_id, Request $request)
{
$person = $this->getDoctrine()->getManager()
->getRepository('ChillPersonBundle:Person')
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
if (null === $person) {

View File

@ -44,7 +44,7 @@ class PersonToIdTransformer implements DataTransformerInterface
}
$issue = $this->om
->getRepository('ChillPersonBundle:Person')
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy(['id' => $id]);
if (null === $issue) {

View File

@ -71,7 +71,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
'PHP_AUTH_PW' => 'password',
]);
$center = self::$em->getRepository('ChillMainBundle:Center')
$center = self::$em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$this->person = (new Person(new DateTime('2015-01-05')))

View File

@ -47,7 +47,7 @@ final class PersonAddressControllerTest extends WebTestCase
$em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$center = $em->getRepository('ChillMainBundle:Center')
$center = $em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
self::$person = (new Person())
@ -195,7 +195,7 @@ final class PersonAddressControllerTest extends WebTestCase
*/
protected function refreshPerson()
{
self::$person = $this->em->getRepository('ChillPersonBundle:Person')
self::$person = $this->em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find(self::$person->getId());
}
}

View File

@ -51,14 +51,14 @@ final class PersonControllerCreateTest extends WebTestCase
$em = self::$kernel->getContainer()->get('doctrine.orm.entity_manager');
//remove two people created during test
$jesus = $em->getRepository('ChillPersonBundle:Person')
$jesus = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy(['firstName' => 'God']);
if (null !== $jesus) {
$em->remove($jesus);
}
$jesus2 = $em->getRepository('ChillPersonBundle:Person')
$jesus2 = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy(['firstName' => 'roger']);
if (null !== $jesus2) {

View File

@ -58,7 +58,7 @@ final class PersonControllerUpdateTest extends WebTestCase
$this->em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$center = $this->em->getRepository('ChillMainBundle:Center')
$center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$this->person = (new Person())
@ -317,7 +317,7 @@ final class PersonControllerUpdateTest extends WebTestCase
*/
protected function refreshPerson()
{
$this->person = $this->em->getRepository('ChillPersonBundle:Person')
$this->person = $this->em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($this->person->getId());
}

View File

@ -57,7 +57,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
$this->em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$center = $this->em->getRepository('ChillMainBundle:Center')
$center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$this->person = (new Person())
@ -211,7 +211,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
*/
protected function refreshPerson()
{
$this->person = $this->em->getRepository('ChillPersonBundle:Person')
$this->person = $this->em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($this->person->getId());
}

View File

@ -42,7 +42,7 @@ final class PersonControllerViewTest extends WebTestCase
$this->em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$center = $this->em->getRepository('ChillMainBundle:Center')
$center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$this->person = (new Person())
@ -113,7 +113,7 @@ final class PersonControllerViewTest extends WebTestCase
*/
protected function refreshPerson()
{
$this->person = $this->em->getRepository('ChillPersonBundle:Person')
$this->person = $this->em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($this->person->getId());
}
}

View File

@ -42,7 +42,7 @@ final class PersonControllerViewWithHiddenFieldsTest extends WebTestCase
$this->em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$center = $this->em->getRepository('ChillMainBundle:Center')
$center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$this->person = (new Person())
@ -99,7 +99,7 @@ final class PersonControllerViewWithHiddenFieldsTest extends WebTestCase
*/
protected function refreshPerson()
{
$this->person = $this->em->getRepository('ChillPersonBundle:Person')
$this->person = $this->em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($this->person->getId());
}
}

View File

@ -27,7 +27,7 @@ final class PersonDuplicateControllerViewTest extends WebTestCase
$this->em = self::$container
->get('doctrine.orm.entity_manager');
$center = $this->em->getRepository('ChillMainBundle:Center')
$center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$this->person = (new Person())

View File

@ -38,7 +38,7 @@ final class PickPersonTypeTest extends KernelTestCase
self::bootKernel();
$this->user = self::$container->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User')
->getRepository(\Chill\MainBundle\Entity\User::class)
->findOneBy(['username' => 'multi_center']);
$this->formFactory = self::$container->get('form.factory');
@ -71,7 +71,7 @@ final class PickPersonTypeTest extends KernelTestCase
{
$this->markTestSkipped('need to inject locale into url generator without request');
$center = self::$container->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:Center')
->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$form = $this->formFactory
@ -104,7 +104,7 @@ final class PickPersonTypeTest extends KernelTestCase
{
$this->markTestSkipped('need to inject locale into url generator without request');
$centers = self::$container->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:Center')
->getRepository(\Chill\MainBundle\Entity\Center::class)
->findAll();
$form = $this->formFactory

View File

@ -78,7 +78,7 @@ class ReportController extends AbstractController
$cFGroup = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
->find($cf_group_id);
$person = $em->getRepository('ChillPersonBundle:Person')
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
if (null === $person || null === $cFGroup) {
@ -212,7 +212,7 @@ class ReportController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
@ -269,7 +269,7 @@ class ReportController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
$cFGroup = $em
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
->find($cf_group_id);
@ -317,7 +317,7 @@ class ReportController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
if (null === $person) {
@ -371,7 +371,7 @@ class ReportController extends AbstractController
])
->getForm();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
return $this->render('ChillReportBundle:Report:select_report_type.html.twig', [
'form' => $form->createView(),
@ -513,7 +513,7 @@ class ReportController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
$entity = $em->getRepository('ChillReportBundle:Report')->find($report_id);

View File

@ -46,7 +46,7 @@ final class ReportControllerNextTest extends WebTestCase
->get('doctrine.orm.entity_manager');
$this->person = $em
->getRepository('ChillPersonBundle:Person')
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy(
[
'lastName' => 'Charline',

View File

@ -65,7 +65,7 @@ final class ReportControllerTest extends WebTestCase
//get a random person
self::$person = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillPersonBundle:Person')
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy(
[
'lastName' => 'Charline',
@ -94,7 +94,7 @@ final class ReportControllerTest extends WebTestCase
self::$user = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User')
->getRepository(\Chill\MainBundle\Entity\User::class)
->findOneBy(['username' => 'center a_social']);
}

View File

@ -52,7 +52,7 @@ final class TimelineProviderTest extends WebTestCase
self::$em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$center = self::$em->getRepository('ChillMainBundle:Center')
$center = self::$em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findOneBy(['name' => 'Center A']);
$person = (new Person(new DateTime('2015-05-01')))
@ -71,7 +71,7 @@ final class TimelineProviderTest extends WebTestCase
);
$report = (new Report())
->setUser(self::$em->getRepository('ChillMainBundle:User')
->setUser(self::$em->getRepository(\Chill\MainBundle\Entity\User::class)
->findOneByUsername('center a_social'))
->setDate(new DateTime('2015-05-02'))
->setPerson($this->person)