Fix loading data for customfield with new templating engine

This commit is contained in:
Julien Fastré 2023-07-23 00:00:23 +02:00
parent 169bf3c140
commit 2ad82e8cc1
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -21,11 +21,13 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectManager; use Doctrine\Persistence\ObjectManager;
use RuntimeException; use RuntimeException;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Environment;
class LoadCustomFields extends AbstractFixture implements class LoadCustomFields extends AbstractFixture implements
ContainerAwareInterface, ContainerAwareInterface,
@ -78,7 +80,7 @@ class LoadCustomFields extends AbstractFixture implements
private function createCustomFieldChoice() private function createCustomFieldChoice()
{ {
return new CustomFieldChoice( return new CustomFieldChoice(
$this->container->get('templating'), $this->container->get(Environment::class),
$this->translatableStringHelper $this->translatableStringHelper
); );
} }
@ -86,14 +88,14 @@ class LoadCustomFields extends AbstractFixture implements
private function createCustomFieldText() private function createCustomFieldText()
{ {
return new CustomFieldText( return new CustomFieldText(
$this->container->get('templating'), $this->container->get(Environment::class),
$this->translatableStringHelper $this->translatableStringHelper
); );
} }
private function loadData(ObjectManager $manager) private function loadData(ObjectManager $manager)
{ {
$personIds = $this->container->get('doctrine.orm.entity_manager') $personIds = $this->container->get(EntityManagerInterface::class)
->createQuery('SELECT person.id FROM ChillPersonBundle:Person person') ->createQuery('SELECT person.id FROM ChillPersonBundle:Person person')
->getScalarResult(); ->getScalarResult();