replace more doctrine shortcuts by fqdn

This commit is contained in:
2022-04-30 00:35:11 +02:00
parent a0392b9216
commit 864e1eeabb
19 changed files with 39 additions and 33 deletions

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Command;
use Chill\MainBundle\Entity\Language;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
@@ -113,7 +114,7 @@ class LoadAndUpdateLanguagesCommand extends Command
)
);
$langageDB = $em->getRepository('ChillMainBundle:Language')->find($code);
$langageDB = $em->getRepository(Language::class)->find($code);
if (!$excludeCode) {
if (!$langageDB) {

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Command;
use Chill\MainBundle\Entity\Country;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
@@ -87,7 +88,7 @@ class LoadCountriesCommand extends Command
$em = $this->entityManager;
foreach ($countries as $country) {
$countryStored = $em->getRepository('ChillMainBundle:Country')
$countryStored = $em->getRepository(Country::class)
->findOneBy(['countryCode' => $country->getCountryCode()]);
if (null === $countryStored) {

View File

@@ -87,7 +87,7 @@ class PermissionsGroupController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($id);
$permissionsGroup = $em->getRepository(\Chill\MainBundle\Entity\PermissionsGroup::class)->find($id);
if (!$permissionsGroup) {
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
@@ -203,8 +203,8 @@ class PermissionsGroupController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($pgid);
$roleScope = $em->getRepository('ChillMainBundle:RoleScope')->find($rsid);
$permissionsGroup = $em->getRepository(\Chill\MainBundle\Entity\PermissionsGroup::class)->find($pgid);
$roleScope = $em->getRepository(\Chill\MainBundle\Entity\RoleScope::class)->find($rsid);
if (!$permissionsGroup) {
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
@@ -269,7 +269,7 @@ class PermissionsGroupController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($id);
$permissionsGroup = $em->getRepository(\Chill\MainBundle\Entity\PermissionsGroup::class)->find($id);
if (!$permissionsGroup) {
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
@@ -319,7 +319,7 @@ class PermissionsGroupController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillMainBundle:PermissionsGroup')->findAll();
$entities = $em->getRepository(\Chill\MainBundle\Entity\PermissionsGroup::class)->findAll();
return $this->render('@ChillMain/PermissionsGroup/index.html.twig', [
'entities' => $entities,
@@ -349,7 +349,7 @@ class PermissionsGroupController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($id);
$permissionsGroup = $em->getRepository(\Chill\MainBundle\Entity\PermissionsGroup::class)->find($id);
if (!$permissionsGroup) {
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
@@ -405,7 +405,7 @@ class PermissionsGroupController extends AbstractController
$em = $this->getDoctrine()->getManager();
$permissionsGroup = $em
->getRepository('ChillMainBundle:PermissionsGroup')
->getRepository(\Chill\MainBundle\Entity\PermissionsGroup::class)
->find($id);
if (!$permissionsGroup) {
@@ -469,7 +469,7 @@ class PermissionsGroupController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$roleScope = $em->getRepository('ChillMainBundle:RoleScope')
$roleScope = $em->getRepository(\Chill\MainBundle\Entity\RoleScope::class)
->findOneBy(['role' => $role, 'scope' => $scope]);
if (null === $roleScope) {

View File

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

View File

@@ -124,7 +124,7 @@ class UserController extends CRUDController
throw $this->createNotFoundException('Unable to find User entity.');
}
$groupCenter = $em->getRepository('ChillMainBundle:GroupCenter')
$groupCenter = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class)
->find($gcid);
if (!$groupCenter) {
@@ -330,7 +330,7 @@ class UserController extends CRUDController
{
$em = $this->getDoctrine()->getManager();
$groupCenterManaged = $em->getRepository('ChillMainBundle:GroupCenter')
$groupCenterManaged = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class)
->findOneBy([
'center' => $groupCenter->getCenter(),
'permissionsGroup' => $groupCenter->getPermissionsGroup(),

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Form\Type\DataTransformer\ObjectToIdTransformer;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\Persistence\ObjectManager;
@@ -50,13 +51,13 @@ class Select2CountryType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$transformer = new ObjectToIdTransformer($this->em, 'Chill\MainBundle\Entity\Country');
$transformer = new ObjectToIdTransformer($this->em, Country::class);
$builder->addModelTransformer($transformer);
}
public function configureOptions(OptionsResolver $resolver)
{
$countries = $this->em->getRepository('Chill\MainBundle\Entity\Country')->findAll();
$countries = $this->em->getRepository(Country::class)->findAll();
$choices = [];
$preferredCountries = $this->parameterBag->get('chill_main.available_countries');
$preferredChoices = [];

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Language;
use Chill\MainBundle\Form\Type\DataTransformer\MultipleObjectsToIdTransformer;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\Persistence\ObjectManager;
@@ -50,13 +51,13 @@ class Select2LanguageType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$transformer = new MultipleObjectsToIdTransformer($this->em, 'Chill\MainBundle\Entity\Language');
$transformer = new MultipleObjectsToIdTransformer($this->em, Language::class);
$builder->addModelTransformer($transformer);
}
public function configureOptions(OptionsResolver $resolver)
{
$languages = $this->em->getRepository('Chill\MainBundle\Entity\Language')->findAll();
$languages = $this->em->getRepository(Language::class)->findAll();
$preferredLanguages = $this->parameterBag->get('chill_main.available_languages');
$choices = [];
$preferredChoices = [];

View File

@@ -85,7 +85,7 @@ abstract class AbstractExportTest extends WebTestCase
$centers = $em->getRepository(\Chill\MainBundle\Entity\Center::class)
->findAll();
$circles = $em->getRepository('ChillMainBundle:Scope')
$circles = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)
->findAll();
if (count($centers) === 0) {