mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-04 12:29:43 +00:00
Fix fixtures
- Inject parameters directly instead of getting from container - User PasswordHasher instead of EncoderFactory - set parameters directly and correctly encode values to json
This commit is contained in:
@@ -52,12 +52,12 @@ class LoadCustomFields extends AbstractFixture implements OrderedFixtureInterfac
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
private function createCustomFieldChoice(): \Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice
|
||||
private function createCustomFieldChoice(): CustomFieldChoice
|
||||
{
|
||||
return $this->customFieldChoice;
|
||||
}
|
||||
|
||||
private function createCustomFieldText(): \Chill\CustomFieldsBundle\CustomFields\CustomFieldText
|
||||
private function createCustomFieldText(): CustomFieldText
|
||||
{
|
||||
return $this->customFieldText;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class LoadCustomFields extends AbstractFixture implements OrderedFixtureInterfac
|
||||
private function loadData(ObjectManager $manager): void
|
||||
{
|
||||
$personIds = $this->entityManager
|
||||
->createQuery('SELECT person.id FROM ChillPersonBundle:Person person')
|
||||
->createQuery('SELECT person.id FROM '.Person::class.' person')
|
||||
->getScalarResult();
|
||||
|
||||
// get possible values for cfGroup
|
||||
|
@@ -84,20 +84,9 @@ final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface
|
||||
$temporaryJsonCriterias[] = [$field, $key, $value, sprintf(':placeholder_%s_%s', $field, $key)];
|
||||
}
|
||||
|
||||
$jsonParameters = array_reduce(
|
||||
$temporaryJsonCriterias,
|
||||
static function (array $carry, array $row): array {
|
||||
[,, $value, $placeholder] = $row;
|
||||
|
||||
return array_merge(
|
||||
$carry,
|
||||
[
|
||||
$placeholder => sprintf('"%s"', $value),
|
||||
]
|
||||
);
|
||||
},
|
||||
[]
|
||||
);
|
||||
foreach ($temporaryJsonCriterias as [$field, $key, $value, $placeholder]) {
|
||||
$qb->setParameter(ltrim($placeholder, ':'), json_encode($value));
|
||||
}
|
||||
|
||||
$jsonPredicates = array_map(
|
||||
static function (array $row) use ($expr): Comparison {
|
||||
@@ -121,7 +110,7 @@ final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface
|
||||
return $qb
|
||||
->select('s')
|
||||
->where(...$jsonPredicates)
|
||||
->setParameters($jsonParameters)
|
||||
// ->setParameters($jsonParameters)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
Reference in New Issue
Block a user