Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2988

Notice: Undefined index: joinColumns in BasicEntityPersister.php

    Details

    • Type: Bug Bug
    • Status: Awaiting Feedback
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.5, 2.4.2, 2.4.7
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      When trying to use findBy on a ManyToMany field i receive the error:

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

      It seems to be caused internally by the code expecting 'joinColumns' to be directly on the association, however it is found under 'joinTable'.
      I have attached a patch that atleast fixes my case, hopefully it can be used to pin-point what the error is.

        Issue Links

          Activity

          Hide
          Ilya Antipenko added a comment -

          As workaround we can collect IDs and pass it to queryBuilder, like:

              public function findAllSwitcherTypeByComponents($components)
              {
                  $ids = [];
                  /** @var Component $component */
                  foreach ($components as $component) {
                      $ids[] = $component->getId();
                  }
          
                  $query = $this->createQueryBuilder('component_switcher_type');
                  $query
                      ->join( 'component_switcher_type.components', 'components', 'WITH', $query->expr()->in('components.id', $ids));
          
                  return $query->getQuery()->getResult();
          }
          
          Show
          Ilya Antipenko added a comment - As workaround we can collect IDs and pass it to queryBuilder, like: public function findAllSwitcherTypeByComponents($components) { $ids = []; /** @ var Component $component */ foreach ($components as $component) { $ids[] = $component->getId(); } $query = $ this ->createQueryBuilder('component_switcher_type'); $query ->join( 'component_switcher_type.components', 'components', 'WITH', $query->expr()->in('components.id', $ids)); return $query->getQuery()->getResult(); }
          Hide
          Marco Pivetta added a comment -

          Don't code workarounds: provide a test case, so that a patch can be created

          Show
          Marco Pivetta added a comment - Don't code workarounds: provide a test case, so that a patch can be created
          Hide
          Ilya Antipenko added a comment -

          I'll this ASAP.

          Show
          Ilya Antipenko added a comment - I'll this ASAP.
          Hide
          Ilya Antipenko added a comment -
          Show
          Ilya Antipenko added a comment - Here is the test: https://github.com/doctrine/doctrine2/pull/1307 Here is the test log on travis-ci: https://travis-ci.org/aivus/doctrine2/builds/51516067
          Hide
          Doctrine Bot added a comment -

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

          Show
          Doctrine Bot added a comment - A related Github Pull-Request [GH-1307] was labeled: https://github.com/doctrine/doctrine2/pull/1307

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Dennis Væversted
            • Votes:
              3 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated: