Skip to content

2.17 - Doctrine\DBAL\ArrayParameters\Exception\MissingPositionalParameter: Positional parameter at index 1 does not have a bound value. #11154

@Gemineye

Description

@Gemineye

Bug Report

Q A
BC Break yes
Version 2.17.2

Summary

We have a ManyToOne Relation to an entity with a composite primary key.
Since Version 2.17 with fetch="EAGER" we get the error:

Doctrine\DBAL\ArrayParameters\Exception\MissingPositionalParameter: Positional parameter at index 1 does not have a bound value.

Current behavior

Doctrine\DBAL\ArrayParameters\Exception\MissingPositionalParameter:
Positional parameter at index 1 does not have a bound value.

  at vendor/doctrine/dbal/src/ArrayParameters/Exception/MissingPositionalParameter.php:19
  at Doctrine\DBAL\ArrayParameters\Exception\MissingPositionalParameter::new(1)
     (vendor/doctrine/dbal/src/ExpandArrayParameters.php:50)
  at Doctrine\DBAL\ExpandArrayParameters->acceptPositionalParameter('?')
     (vendor/doctrine/dbal/src/SQL/Parser.php:88)
  at Doctrine\DBAL\SQL\Parser::Doctrine\DBAL\SQL\{closure}('?')
     (vendor/doctrine/dbal/src/SQL/Parser.php:102)
  at Doctrine\DBAL\SQL\Parser->parse('SELECT t0.id AS id_1, t0.description AS description_2, t0.sorting AS sorting_3, t0.changed_by AS changed_by_4, t0.created_at AS created_at_5, t0.updated_at AS updated_at_6, t0.service_id AS service_id_7, t0.company_id AS company_id_8, t0.company_id AS company_id_9 FROM services_description t0 WHERE t0.service_id IN (?) AND t0.company_id IN (?)', object(ExpandArrayParameters))
     (vendor/doctrine/dbal/src/Connection.php:1900)
  at Doctrine\DBAL\Connection->expandArrayParameters('SELECT t0.id AS id_1, t0.description AS description_2, t0.sorting AS sorting_3, t0.changed_by AS changed_by_4, t0.created_at AS created_at_5, t0.updated_at AS updated_at_6, t0.service_id AS service_id_7, t0.company_id AS company_id_8, t0.company_id AS company_id_9 FROM services_description t0 WHERE t0.service_id IN (?) AND t0.company_id IN (?)', array(array('service1', '12345', 'service2', '12345', 'service3', '12345', 'service4', '12345', 'service5', '12345', 'service6', '12345')), array(102, 102))
     (vendor/doctrine/dbal/src/Connection.php:1091)
  at Doctrine\DBAL\Connection->executeQuery('SELECT t0.id AS id_1, t0.description AS description_2, t0.sorting AS sorting_3, t0.changed_by AS changed_by_4, t0.created_at AS created_at_5, t0.updated_at AS updated_at_6, t0.service_id AS service_id_7, t0.company_id AS company_id_8, t0.company_id AS company_id_9 FROM dav_pharmacy_services_description t0 WHERE t0.service_id IN (?) AND t0.company_id IN (?)', array(array('service1', '12345', 'service2', '12345', 'service3', '12345', 'service4', '12345', 'service5', '12345', 'service6', '12345')), array(102, 102))
     (vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:939)
  at Doctrine\ORM\Persisters\Entity\BasicEntityPersister->loadAll(array('service' => array(object(Service), object(Service), object(Service), object(Service), object(Service), object(Service))))
     (vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3182)
  at Doctrine\ORM\UnitOfWork->eagerLoadCollections(array('service1 12345' => object(PersistentCollection), 'service2 12345' => object(PersistentCollection), 'service3 12345' => object(PersistentCollection), 'service4 12345' => object(PersistentCollection), 'service5 12345' => object(PersistentCollection), 'service6 12345' => object(PersistentCollection)), array('fieldName' => 'serviceDescriptions', 'mappedBy' => 'service', 'targetEntity' => 'App\\SelfService\\Domain\\Model\\ServiceDescription', 'cascade' => array(), 'orphanRemoval' => false, 'fetch' => 3, 'type' => 4, 'inversedBy' => null, 'isOwningSide' => false, 'sourceEntity' => 'App\\SelfService\\Domain\\Model\\Service', 'isCascadeRemove' => false, 'isCascadePersist' => false, 'isCascadeRefresh' => false, 'isCascadeMerge' => false, 'isCascadeDetach' => false))
     (vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3156)
  at Doctrine\ORM\UnitOfWork->triggerEagerLoads()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:68)
  at Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator->hydrateAllData()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:270)
  at Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll(object(Result), object(ResultSetMapping), array('deferEagerLoad' => true))
     (vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:943)
  at Doctrine\ORM\Persisters\Entity\BasicEntityPersister->loadAll(array('company' => '12345', 'online' => true), array('sorting' => 'ASC'), null, null)
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:225)
  at Doctrine\ORM\EntityRepository->findBy(array('company' => '12345', 'online' => true), array('sorting' => 'ASC'))
     (src/SelfService/Domain/Model/ServiceRepository.php:64)
  at App\SelfService\Domain\Model\ServiceRepository->findOfferedBy(object(ApoId), true)
     (src/Services/Controller/ServicesController.php:50)
  at App\Services\Controller\ServicesController->indexAction(object(ApoId), object(DataCollectorTranslator), object(Registry))
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:40)
  at require_once('/var/www/app/vendor/autoload_runtime.php')
     (public/index.php:7)                

How to reproduce

Relation definition:

    /**
     * @ORM\Id
     * @ORM\Column(name="service_name")
     */
    protected string $serviceName;

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="App\Entity\Company")
     * @ORM\JoinColumn(name="company_id", referencedColumnName="company_id", nullable=false)
     */
    protected Company $company;

    /**
     * @var Collection<int, ServiceDescription>
     * @ORM\OneToMany(targetEntity="App\Entity\ServiceDescription", mappedBy="service")
     */
    protected Collection $serviceDescriptions;
    /**
     * @ORM\ManyToOne(targetEntity="App\Entity\Service", inversedBy="serviceDescriptions")
     * @ORM\JoinColumns(
     *     @ORM\JoinColumn(name="service_name", referencedColumnName="service_name"),
     *     @ORM\JoinColumn(name="company_id", referencedColumnName="company_id", nullable=false)
     * )
     */
    protected PharmacyService $serviceId;

Expected behavior

No Exception should occur.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions