DDC-3809: Notice: Undefined index in /lib/Doctrine/ORM/Query/SqlWalker.php at line 1920 #4664

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

Originally created by @doctrinebot on GitHub (Jul 7, 2015).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user dkarlovi:

I have two entities, AchievementGoal & AchievementLevel, like so:

/****
 * AchievementLevel
 * @ORM\Table("achievements_levels")
 * @ORM\Entity
 * @ORM\Entity(repositoryClass="AppBundle\Entity\AchievementLevelRepository")
 */
class AchievementLevel
{
    /****
     * @ORM\OneToMany(targetEntity="AppBundle\Entity\AchievementGoal", mappedBy="achievementLevel")
     ****/
    private $goals;

    public function **construct()
    {
        $this->goals = new ArrayCollection();
    }
}

/****
 * AchievementGoal
 * @ORM\Table("achievements_goals")
 * @ORM\Entity
 */
class AchievementGoal
{
    /****
     * @var AchievementLevel
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\AchievementLevel", inversedBy="goals")
     * @ORM\Column(name="achievement*level*id")
     */
    private $achievementLevel;

    /****
     * @var Variable
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Variable")
     */
    private $variable;
}

When I try to do query like:

        $qb = $this->getEntityManager()->createQueryBuilder();
        $qb->select('l')
            ->from('AppBundle:AchievementLevel', 'l')
            ->where('EXISTS (
                SELECT g FROM AppBundle:AchievementGoal g WHERE g MEMBER OF l.goals
            )');

I get the error:
Notice: Undefined index: achievementLevel in vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php at line 1920. There seems to be a problem when using both @Id and @Column on the property, if I remove either one, it works (throws some other error, but unrelated to this).

Originally created by @doctrinebot on GitHub (Jul 7, 2015). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user dkarlovi: I have two entities, AchievementGoal & AchievementLevel, like so: ``` /**** * AchievementLevel * @ORM\Table("achievements_levels") * @ORM\Entity * @ORM\Entity(repositoryClass="AppBundle\Entity\AchievementLevelRepository") */ class AchievementLevel { /**** * @ORM\OneToMany(targetEntity="AppBundle\Entity\AchievementGoal", mappedBy="achievementLevel") ****/ private $goals; public function **construct() { $this->goals = new ArrayCollection(); } } /**** * AchievementGoal * @ORM\Table("achievements_goals") * @ORM\Entity */ class AchievementGoal { /**** * @var AchievementLevel * @ORM\Id * @ORM\ManyToOne(targetEntity="AppBundle\Entity\AchievementLevel", inversedBy="goals") * @ORM\Column(name="achievement*level*id") */ private $achievementLevel; /**** * @var Variable * @ORM\Id * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Variable") */ private $variable; } ``` When I try to do query like: ``` $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('l') ->from('AppBundle:AchievementLevel', 'l') ->where('EXISTS ( SELECT g FROM AppBundle:AchievementGoal g WHERE g MEMBER OF l.goals )'); ``` I get the error: Notice: Undefined index: achievementLevel in vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php at line 1920. There seems to be a problem when using both @Id and @Column on the property, if I remove either one, it works (throws some other error, but unrelated to this).
admin added the Bug label 2026-01-22 14:47:08 +01:00
admin closed this issue 2026-01-22 14:47:09 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jul 7, 2015):

Comment created by dkarlovi:

Well, this is awkward. It seems I used @Column instead of @JoinColumn. Only figured it out once I saw Symfony toolbar said I have an invalid mapping. Is there a way for a error to be thrown here?

Hope this helps someone, closing.

@doctrinebot commented on GitHub (Jul 7, 2015): Comment created by dkarlovi: Well, this is awkward. It seems I used @Column instead of @JoinColumn. Only figured it out once I saw Symfony toolbar said I have an invalid mapping. Is there a way for a error to be thrown here? Hope this helps someone, closing.
Author
Owner

@doctrinebot commented on GitHub (Jul 7, 2015):

Comment created by dkarlovi:

Invalid issue, using @Column instead of @JoinColumn. Should trigger an error if possible here, though.

@doctrinebot commented on GitHub (Jul 7, 2015): Comment created by dkarlovi: Invalid issue, using @Column instead of @JoinColumn. Should trigger an error if possible here, though.
Author
Owner

@doctrinebot commented on GitHub (Jul 7, 2015):

Issue was closed with resolution "Invalid"

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

No dependencies set.

Reference: doctrine/archived-orm#4664