DDC-2345: convertObjectParameterToScalarValue() raises a notice #2945

Closed
opened 2026-01-22 14:08:07 +01:00 by admin · 6 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 12, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user garak:

In Doctrine\ORM\AbstractQuery.php, the method convertObjectParameterToScalarValue() can raise a Notice.
This code:

$value = $values[$class->getSingleIdentifierFieldName()];

should be changed in this one:

if (isset($values[$class->getSingleIdentifierFieldName()])) {
    $value = $values[$class->getSingleIdentifierFieldName()];
}
Originally created by @doctrinebot on GitHub (Mar 12, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user garak: In `Doctrine\ORM\AbstractQuery.php`, the method `convertObjectParameterToScalarValue()` can raise a Notice. This code: ``` $value = $values[$class->getSingleIdentifierFieldName()]; ``` should be changed in this one: ``` if (isset($values[$class->getSingleIdentifierFieldName()])) { $value = $values[$class->getSingleIdentifierFieldName()]; } ```
admin added the Bug label 2026-01-22 14:08:07 +01:00
admin closed this issue 2026-01-22 14:08:07 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2013):

Comment created by @ocramius:

[~garak] the current DQL implementation doesn't allow you to bind composite key identifiers as parameters, thus you will never reach that piece of code.

A test would be needed for this case.

@doctrinebot commented on GitHub (Mar 12, 2013): Comment created by @ocramius: [~garak] the current DQL implementation doesn't allow you to bind composite key identifiers as parameters, thus you will never reach that piece of code. A test would be needed for this case.
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2013):

Comment created by garak:

Unfortunately, I'm not really a Doctrine guru.
I can tell you that I'm getting that notice, using Sortable behavior with Symfony2.
This is a partial error stack:

1 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 282

2 at ErrorHandler ->handle ('8', 'Undefined index: id', '(...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php', '282', array('value' => object(MyEntity), 'class' => object(ClassMetadata), 'values' => array()))

3 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 282
at AbstractQuery ->convertObjectParameterToScalarValue (object(MyEntity))

4 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 260
at AbstractQuery ->processParameterValue (object(MyEntity))

5 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php at line 285
at Query ->processParameterMappings (array('group**1' => array('0')))

6 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php at line 258
at Query ->_doExecute ()

7 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 737
at AbstractQuery ->execute (null, '1')

8 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 538
at AbstractQuery ->getResult ()

9 in (...)/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sortable/SortableListener.php at line 410
at SortableListener ->getMaxPosition (object(EntityManager), object(ClassMetadata), array('position' => 'rank', 'groups' => array('my_entity'), 'useObjectClass' => 'Meeting\GestioneBundle\Entity\MyRelatedEntity'), object(MyRelatedEntity))

10 in (...)/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sortable/SortableListener.php at line 114
at SortableListener ->prePersist (object(LifecycleEventArgs))

11 in (...)/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php at line 61
@doctrinebot commented on GitHub (Mar 12, 2013): Comment created by garak: Unfortunately, I'm not really a Doctrine guru. I can tell you that I'm getting that notice, using Sortable behavior with Symfony2. This is a partial error stack: ``` 1 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 282 2 at ErrorHandler ->handle ('8', 'Undefined index: id', '(...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php', '282', array('value' => object(MyEntity), 'class' => object(ClassMetadata), 'values' => array())) 3 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 282 at AbstractQuery ->convertObjectParameterToScalarValue (object(MyEntity)) 4 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 260 at AbstractQuery ->processParameterValue (object(MyEntity)) 5 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php at line 285 at Query ->processParameterMappings (array('group**1' => array('0'))) 6 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php at line 258 at Query ->_doExecute () 7 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 737 at AbstractQuery ->execute (null, '1') 8 in (...)/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 538 at AbstractQuery ->getResult () 9 in (...)/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sortable/SortableListener.php at line 410 at SortableListener ->getMaxPosition (object(EntityManager), object(ClassMetadata), array('position' => 'rank', 'groups' => array('my_entity'), 'useObjectClass' => 'Meeting\GestioneBundle\Entity\MyRelatedEntity'), object(MyRelatedEntity)) 10 in (...)/vendor/gedmo/doctrine-extensions/lib/Gedmo/Sortable/SortableListener.php at line 114 at SortableListener ->prePersist (object(LifecycleEventArgs)) 11 in (...)/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php at line 61 ```
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2013):

Comment created by @ocramius:

[~garak] having a composite primary key?

@doctrinebot commented on GitHub (Mar 12, 2013): Comment created by @ocramius: [~garak] having a composite primary key?
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2013):

Comment created by garak:

Nope, just a plain "id".

@doctrinebot commented on GitHub (Mar 12, 2013): Comment created by garak: Nope, just a plain "id".
Author
Owner

@doctrinebot commented on GitHub (May 1, 2013):

Comment created by @beberlei:

Fixed in 2.4

@doctrinebot commented on GitHub (May 1, 2013): Comment created by @beberlei: Fixed in 2.4
Author
Owner

@doctrinebot commented on GitHub (May 1, 2013):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (May 1, 2013): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2945