DDC-2808: Notice: Undefined index: joinColumns in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1527 with many-to-many relation and contains criteria #3508

Closed
opened 2026-01-22 14:21:18 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 21, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user warrior:

Field Annotation:

     /****
     * @ORM\ManyToMany(targetEntity="Asset")
     * @ORM\JoinTable(
     *      name="bookings_assets",
     *      joinColumns={@ORM\JoinColumn(name="booking_id", referencedColumnName="id", onDelete="CASCADE", nullable=false)},
     *      inverseJoinColumns={@ORM\JoinColumn(name="asset_id", referencedColumnName="id", onDelete="CASCADE", nullable=false)}
     * )
     */

Criteria definition:

        $criteria = Criteria::create();
        $criteria
            ->where($criteria::expr()->contains('assets', $asset))
        ;

Throws error when apply this criteria to not-loaded collection (via persistent collection). Do not throws any errors when works with ArrayCollection.
The error is

        Notice: Undefined index: joinColumns in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1527

It seems that annotationMapptings array doesn't contains joinColumns in root, it contains this key under joinTable key. May be fix would be (line 1527)

return $this->*getSQLTableAlias($className) . '.' . (isset($this->_class->associationMappings[$field]['joinColumns']) ? $this->_class->associationMappings[$field]['joinColumns'][0]['name'] : $this->*class->associationMappings[$field]['joinTable']['joinColumns'][0]['name']);

Update:
After this fix I got the next error:

Notice: Undefined index: CONTAINS in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1490

Seems that you doesn't support contains method in this persister

Originally created by @doctrinebot on GitHub (Nov 21, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user warrior: Field Annotation: ``` /**** * @ORM\ManyToMany(targetEntity="Asset") * @ORM\JoinTable( * name="bookings_assets", * joinColumns={@ORM\JoinColumn(name="booking_id", referencedColumnName="id", onDelete="CASCADE", nullable=false)}, * inverseJoinColumns={@ORM\JoinColumn(name="asset_id", referencedColumnName="id", onDelete="CASCADE", nullable=false)} * ) */ ``` Criteria definition: ``` $criteria = Criteria::create(); $criteria ->where($criteria::expr()->contains('assets', $asset)) ; ``` Throws error when apply this criteria to not-loaded collection (via persistent collection). Do not throws any errors when works with ArrayCollection. The error is ``` Notice: Undefined index: joinColumns in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1527 ``` It seems that annotationMapptings array doesn't contains joinColumns in root, it contains this key under joinTable key. May be fix would be (line 1527) ``` return $this->*getSQLTableAlias($className) . '.' . (isset($this->_class->associationMappings[$field]['joinColumns']) ? $this->_class->associationMappings[$field]['joinColumns'][0]['name'] : $this->*class->associationMappings[$field]['joinTable']['joinColumns'][0]['name']); ``` Update: After this fix I got the next error: ``` Notice: Undefined index: CONTAINS in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1490 ``` Seems that you doesn't support contains method in this persister
admin added the Bug label 2026-01-22 14:21:18 +01:00
admin closed this issue 2026-01-22 14:21:18 +01:00
Author
Owner

@doctrinebot commented on GitHub (Nov 21, 2013):

@doctrinebot commented on GitHub (Nov 21, 2013): - is duplicated by [DDC-2988: Notice: Undefined index: joinColumns in BasicEntityPersister.php](http://www.doctrine-project.org/jira/browse/DDC-2988)
Author
Owner

@doctrinebot commented on GitHub (Feb 9, 2014):

Comment created by @beberlei:

Contains is not supported in ORM 2.3, only stating with 2.5

@doctrinebot commented on GitHub (Feb 9, 2014): Comment created by @beberlei: Contains is not supported in ORM 2.3, only stating with 2.5
Author
Owner

@doctrinebot commented on GitHub (Feb 9, 2014):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Feb 9, 2014): Issue was closed with resolution "Invalid"
Author
Owner

@doctrinebot commented on GitHub (Feb 19, 2014):

Comment created by @deeky666:

[~beberlei] I think this is not only related to 2.5. The original issue describe here refers to a PHP warning "Notice: Undefined index: joinColumns in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1527" which has nothing todo with contains support IMO. See related issue: DDC-2988

@doctrinebot commented on GitHub (Feb 19, 2014): Comment created by @deeky666: [~beberlei] I think this is not only related to 2.5. The original issue describe here refers to a PHP warning "Notice: Undefined index: joinColumns in Doctrine/ORM/Persisters/BasicEntityPersister.php line 1527" which has nothing todo with contains support IMO. See related issue: [DDC-2988](http://www.doctrine-project.org/jira/browse/DDC-2988)
Author
Owner

@doctrinebot commented on GitHub (Mar 16, 2015):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-1307] was labeled:
https://github.com/doctrine/doctrine2/pull/1307

@doctrinebot commented on GitHub (Mar 16, 2015): Comment created by @doctrinebot: A related Github Pull-Request [GH-1307] was labeled: https://github.com/doctrine/doctrine2/pull/1307
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3508