Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2808

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.3.5
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Symfony 2.3.8-DEV

      Description

      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

        Issue Links

          Activity

          Hide
          Benjamin Eberlei added a comment -

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

          Show
          Benjamin Eberlei added a comment - Contains is not supported in ORM 2.3, only stating with 2.5
          Hide
          Steve Müller added a comment -

          Benjamin Eberlei 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

          Show
          Steve Müller added a comment - Benjamin Eberlei 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

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Alex WARrior
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: