mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
replace more doctrine shortcuts by fqdn
This commit is contained in:
parent
a0392b9216
commit
864e1eeabb
@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Tests\Controller;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use RuntimeException;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
@ -209,7 +210,7 @@ final class ActivityControllerTest extends WebTestCase
|
||||
|
||||
//get the social PermissionGroup, and remove CHILL_ACTIVITY_*
|
||||
$socialPermissionGroup = $em
|
||||
->getRepository('ChillMainBundle:PermissionsGroup')
|
||||
->getRepository(\Chill\MainBundle\Entity\PermissionsGroup::class)
|
||||
->findOneByName('social');
|
||||
$withoutActivityPermissionGroup = (new \Chill\MainBundle\Entity\PermissionsGroup())
|
||||
->setName('social without activity');
|
||||
@ -323,7 +324,7 @@ final class ActivityControllerTest extends WebTestCase
|
||||
{
|
||||
$types = self::$kernel->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->getRepository('ChillActivityBundle:ActivityType')
|
||||
->getRepository(ActivityType::class)
|
||||
->findAll();
|
||||
|
||||
return $types[array_rand($types)];
|
||||
|
@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Tests\Form\Type;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Form\Type\TranslatableActivityType;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
@ -95,7 +96,7 @@ final class TranslatableActivityTypeTest extends KernelTestCase
|
||||
protected function getRandomType($active = true)
|
||||
{
|
||||
$types = $this->container->get('doctrine.orm.entity_manager')
|
||||
->getRepository('ChillActivityBundle:ActivityType')
|
||||
->getRepository(ActivityType::class)
|
||||
->findBy(['active' => $active]);
|
||||
|
||||
return $types[array_rand($types)];
|
||||
|
@ -456,7 +456,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
$center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
|
||||
->findByName($centerName);
|
||||
|
||||
$circles = $this->em->getRepository('ChillMainBundle:Scope')
|
||||
$circles = $this->em->getRepository(\Chill\MainBundle\Entity\Scope::class)
|
||||
->findAll();
|
||||
array_filter($circles, static function ($circle) use ($circleName) {
|
||||
return in_array($circleName, $circle->getName(), true);
|
||||
|
@ -333,7 +333,7 @@ final class EventSearchTest extends WebTestCase
|
||||
*/
|
||||
protected function getCircle($name = 'social')
|
||||
{
|
||||
$circles = $this->entityManager->getRepository('ChillMainBundle:Scope')
|
||||
$circles = $this->entityManager->getRepository(\Chill\MainBundle\Entity\Scope::class)
|
||||
->findAll();
|
||||
|
||||
/** @var \Chill\MainBundle\Entity\Scope $circle */
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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.');
|
||||
|
@ -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(),
|
||||
|
@ -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 = [];
|
||||
|
@ -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 = [];
|
||||
|
@ -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) {
|
||||
|
@ -173,7 +173,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface
|
||||
case 'countryOfBirth':
|
||||
case 'nationality':
|
||||
$countryRepository = $this->entityManager
|
||||
->getRepository('ChillMainBundle:Country');
|
||||
->getRepository(\Chill\MainBundle\Entity\Country::class);
|
||||
|
||||
// load all countries in a single query
|
||||
$countryRepository->findBy(['countryCode' => $values]);
|
||||
|
@ -70,7 +70,7 @@ final class PersonAddressControllerTest extends WebTestCase
|
||||
$this->em = self::$kernel->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
$this->postalCode = $this->em->getRepository('ChillMainBundle:PostalCode')
|
||||
$this->postalCode = $this->em->getRepository(\Chill\MainBundle\Entity\PostalCode::class)
|
||||
->findOneBy(['code' => 1000]);
|
||||
|
||||
$this->client = self::createClient([], [
|
||||
|
@ -192,7 +192,7 @@ final class PersonControllerUpdateTest extends WebTestCase
|
||||
case 'nationality':
|
||||
case 'countryOfBirth':
|
||||
if (false === empty($value)) {
|
||||
$country = $this->em->getRepository('ChillMainBundle:Country')
|
||||
$country = $this->em->getRepository(\Chill\MainBundle\Entity\Country::class)
|
||||
->findOneByCountryCode($value);
|
||||
$transformedValue = $country->getId();
|
||||
} else {
|
||||
|
@ -126,7 +126,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
case 'nationality':
|
||||
case 'countryOfBirth':
|
||||
if (null !== $value) {
|
||||
$country = $this->em->getRepository('ChillMainBundle:Country')
|
||||
$country = $this->em->getRepository(\Chill\MainBundle\Entity\Country::class)
|
||||
->findOneByCountryCode($value);
|
||||
$transformedValue = $country->getId();
|
||||
} else {
|
||||
|
@ -246,7 +246,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
|
||||
case 'person_countryOfBirth':
|
||||
case 'person_nationality':
|
||||
$countryRepository = $this->em
|
||||
->getRepository('ChillMainBundle:Country');
|
||||
->getRepository(\Chill\MainBundle\Entity\Country::class);
|
||||
|
||||
// load all countries in a single query
|
||||
$countryRepository->findBy(['countryCode' => $values]);
|
||||
|
@ -65,7 +65,7 @@ final class TimelineProviderTest extends WebTestCase
|
||||
|
||||
$scopesSocial = array_filter(
|
||||
self::$em
|
||||
->getRepository('ChillMainBundle:Scope')
|
||||
->getRepository(\Chill\MainBundle\Entity\Scope::class)
|
||||
->findAll(),
|
||||
static function (Scope $scope) { return $scope->getName()['en'] === 'social'; }
|
||||
);
|
||||
|
@ -72,7 +72,7 @@ class Version20150622233319 extends AbstractMigration implements ContainerAwareI
|
||||
|
||||
//add a default scope
|
||||
$scopes = $this->container->get('doctrine.orm.default_entity_manager')
|
||||
->getRepository('ChillMainBundle:Scope')
|
||||
->getRepository(\Chill\MainBundle\Entity\Scope::class)
|
||||
->findAll();
|
||||
|
||||
if (count($scopes) > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user