Your project must not contain invalid function or method calls 12

More information: https://insight.symfony.com/what-we-analyse/php.invalid_call

  1. /**
  2. * @throws InvalidOptionsException
  3. */
  4. protected function getManager(string $class, string $lookupField): ObjectManager
  5. {
  6. $manager = $this->registry->getManagerForClass($class);
    Parameter #1 $class of method Doctrine\Persistence\ManagerRegistry::getManagerForClass() expects class-string, string given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  7. if (!$manager) {
  8. throw new InvalidOptionsException(\sprintf('Class "%s" is not a managed Doctrine entity.', $class));
  9. }
  10. if (!$manager->getClassMetadata($class)->hasField($lookupField)) {
  1. $manager = $this->registry->getManagerForClass($class);
  2. if (!$manager) {
  3. throw new InvalidOptionsException(\sprintf('Class "%s" is not a managed Doctrine entity.', $class));
  4. }
  5. if (!$manager->getClassMetadata($class)->hasField($lookupField)) {
    Unable to resolve the template type T in call to method Doctrine\Persistence\ObjectManager::getClassMetadata()
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  6. throw new InvalidOptionsException(\sprintf('Field "%s" does not exist in entity "%s".', $lookupField, $class));
  7. }
  8. return $manager;
  9. }
  1. $manager = $this->registry->getManagerForClass($class);
  2. if (!$manager) {
  3. throw new InvalidOptionsException(\sprintf('Class "%s" is not a managed Doctrine entity.', $class));
  4. }
  5. if (!$manager->getClassMetadata($class)->hasField($lookupField)) {
    Parameter #1 $className of method Doctrine\Persistence\ObjectManager::getClassMetadata() expects class-string<object>, string given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  6. throw new InvalidOptionsException(\sprintf('Field "%s" does not exist in entity "%s".', $lookupField, $class));
  7. }
  8. return $manager;
  9. }
  1. parent::configureOptions($resolver);
  2. $resolver->setNormalizer(
  3. 'constraints',
  4. function (Options $options, mixed $constraints): array {
  5. $this->getManager($options['class'], $options['lookup_field']);
    Parameter #2 $lookupField of method JG\BatchEntityImportBundle\Form\Type\AbstractEntityLookupType::getManager() expects string, mixed given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  6. /** @var Constraint[] $constraints */
  7. $constraints = \is_array($constraints) ? $constraints : [$constraints];
  8. $constraints[] = new RelatedEntityExists(class: $options['class'], lookupField: $options['lookup_field']);
  1. parent::configureOptions($resolver);
  2. $resolver->setNormalizer(
  3. 'constraints',
  4. function (Options $options, mixed $constraints): array {
  5. $this->getManager($options['class'], $options['lookup_field']);
    Parameter #1 $class of method JG\BatchEntityImportBundle\Form\Type\AbstractEntityLookupType::getManager() expects string, mixed given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  6. /** @var Constraint[] $constraints */
  7. $constraints = \is_array($constraints) ? $constraints : [$constraints];
  8. $constraints[] = new RelatedEntityExists(class: $options['class'], lookupField: $options['lookup_field']);
  1. parent::configureOptions($resolver);
  2. $resolver->setDefaults([
  3. 'placeholder' => '---',
  4. 'translation_domain' => false,
  5. 'choices' => fn (Options $options): array => $this->getChoices($options['class'], $options['lookup_field']),
    Parameter #2 $lookupField of method JG\BatchEntityImportBundle\Form\Type\EntityLookupType::getChoices() expects string, mixed given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  6. ]);
  7. }
  8. /**
  9. * Called between requests in long-running processes, so new entities are visible.
  1. parent::configureOptions($resolver);
  2. $resolver->setDefaults([
  3. 'placeholder' => '---',
  4. 'translation_domain' => false,
  5. 'choices' => fn (Options $options): array => $this->getChoices($options['class'], $options['lookup_field']),
    Parameter #1 $class of method JG\BatchEntityImportBundle\Form\Type\EntityLookupType::getChoices() expects string, mixed given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  6. ]);
  7. }
  8. /**
  9. * Called between requests in long-running processes, so new entities are visible.
  1. }
  2. $manager = $this->getManager($class, $lookupField);
  3. $propertyAccessor = PropertyAccess::createPropertyAccessor();
  4. $choices = [];
  5. foreach ($manager->getRepository($class)->findAll() as $entity) {
    Parameter #1 $className of method Doctrine\Persistence\ObjectManager::getRepository() expects class-string<object>, string given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  6. /** @var string|int|null $value */
  7. $value = $propertyAccessor->getValue($entity, $lookupField);
  8. if (null === $value || '' === $value) {
  9. continue;
  10. }
  1. }
  2. $manager = $this->getManager($class, $lookupField);
  3. $propertyAccessor = PropertyAccess::createPropertyAccessor();
  4. $choices = [];
  5. foreach ($manager->getRepository($class)->findAll() as $entity) {
    Unable to resolve the template type T in call to method Doctrine\Persistence\ObjectManager::getRepository()
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  6. /** @var string|int|null $value */
  7. $value = $propertyAccessor->getValue($entity, $lookupField);
  8. if (null === $value || '' === $value) {
  9. continue;
  10. }
  1. }
  2. }
  3. private function exists(RelatedEntityExists $constraint, string|int|float|bool $value): bool
  4. {
  5. $manager = $this->registry->getManagerForClass($constraint->class);
    Parameter #1 $class of method Doctrine\Persistence\ManagerRegistry::getManagerForClass() expects class-string, string given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  6. return null !== $manager?->getRepository($constraint->class)->findOneBy([$constraint->lookupField => $value]);
  7. }
  8. }
  1. private function exists(RelatedEntityExists $constraint, string|int|float|bool $value): bool
  2. {
  3. $manager = $this->registry->getManagerForClass($constraint->class);
  4. return null !== $manager?->getRepository($constraint->class)->findOneBy([$constraint->lookupField => $value]);
    Parameter #1 $className of method Doctrine\Persistence\ObjectManager::getRepository() expects class-string<object>, string given.
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  5. }
  6. }
  1. private function exists(RelatedEntityExists $constraint, string|int|float|bool $value): bool
  2. {
  3. $manager = $this->registry->getManagerForClass($constraint->class);
  4. return null !== $manager?->getRepository($constraint->class)->findOneBy([$constraint->lookupField => $value]);
    Unable to resolve the template type T in call to method Doctrine\Persistence\ObjectManager::getRepository()
    Time to fix: about 9 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Jarosław Grygierek
  5. }
  6. }

Your project must not contain invalid instantiations 2

More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation

  1. function (Options $options, mixed $constraints): array {
  2. $this->getManager($options['class'], $options['lookup_field']);
  3. /** @var Constraint[] $constraints */
  4. $constraints = \is_array($constraints) ? $constraints : [$constraints];
  5. $constraints[] = new RelatedEntityExists(class: $options['class'], lookupField: $options['lookup_field']);
    Parameter $class of class JG\BatchEntityImportBundle\Validator\Constraints\RelatedEntityExists constructor expects string, mixed given.
    Last edited by Jarosław Grygierek
  6. return $constraints;
  7. },
  8. );
  9. }
  1. function (Options $options, mixed $constraints): array {
  2. $this->getManager($options['class'], $options['lookup_field']);
  3. /** @var Constraint[] $constraints */
  4. $constraints = \is_array($constraints) ? $constraints : [$constraints];
  5. $constraints[] = new RelatedEntityExists(class: $options['class'], lookupField: $options['lookup_field']);
    Parameter $lookupField of class JG\BatchEntityImportBundle\Validator\Constraints\RelatedEntityExists constructor expects string, mixed given.
    Last edited by Jarosław Grygierek
  6. return $constraints;
  7. },
  8. );
  9. }