Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-1352

ErrorException: Undefined index in array

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Invalid
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None
    • Environment:
      Windows 7, PHP 5.3.3

      Description

      The following query:
      "select c.id
      from \\Domain
      Cuisine c
      left join c.nameTranslation t
      left join t.translationValues v
      left join v.language l
      where v.value = :name
      and l.id = :languageId"

      Results in a PHP ErrorException in \Doctrine\ORM\Query\SqlWalker line 745:
      $assoc = ( ! $relation['isOwningSide']) ? $targetClass->associationMappings[$relation['mappedBy']] : $relation;

      When I step through the execution, the array entry: $relation['mappedBy'] gets the following value: "Domain\Translation" in the scope where the error occurs.
      $targetClass->associationMappings has the following indices: "translation" and "language" and this leads to a "Undefined index" error and the execution breaks. It means that I cannot execute DQL queries, which is critical for the application to run.

      <entity name="Domain\Cuisine" table="Cuisine" repository-class="Infrastructure\Persistence\Doctrine\Repository\CuisineRepository">
      <id name="id" type="integer" column="Id">
      <generator strategy="AUTO"/>
      </id>
      <many-to-one target-entity="Domain\Translation" field="nameTranslation">
      <join-column name="NameTranslation_Id" referenced-column-name="Id"/>
      </many-to-one>
      </entity>

      <entity name="Domain\Translation" table="Translations">
      <id name="id" type="integer" column="Id">
      <generator strategy="AUTO" />
      </id>
      <one-to-many target-entity="Domain\TranslationValue" mapped-by="Domain\Translation" field="translationValues" orphan-removal="true">
      <cascade>
      <cascade-all/>
      </cascade>
      </one-to-many>
      </entity>

      <entity name="Domain\TranslationValue" table="TranslationValues">
      <id name="id" type="integer" column="Id">
      <generator strategy="AUTO" />
      </id>

      <field name="value" type="string" column="Value" />

      <many-to-one field="translation" target-entity="Domain\Translation">
      <join-column name="Translation_Id" nullable="false" referenced-column-name="Id" />
      </many-to-one>

      <many-to-one field="language" target-entity="Domain\Language">
      <join-column name="Language_Id" nullable="false" referenced-column-name="Id" />
      </many-to-one>
      </entity>

      <entity name="Domain\Language" table="Languages" repository-class="\Infrastructure\Persistence\Doctrine\Repository\TranslationRepository">
      <id name="id" type="integer" column="Id">
      <generator strategy="AUTO" />
      </id>
      <field name="name" type="string" column="Name" />
      <field name="shortIsoCode" type="string" column="ShortIsoCode"/>
      <field name="longIsoCode" type="string" column="LongIsoCode"/>
      <field name="isDefault" type="boolean" column="IsDefault" />
      </entity>

        Activity

        sorenmh Søren created issue -
        Hide
        guilhermeblanco Guilherme Blanco added a comment -

        Your mapping information is wrong.
        The mappedBy value must reference the field name of the owning side, and not the class name.

        Marking ticket as invalid.

        Show
        guilhermeblanco Guilherme Blanco added a comment - Your mapping information is wrong. The mappedBy value must reference the field name of the owning side, and not the class name. Marking ticket as invalid.
        guilhermeblanco Guilherme Blanco made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Benjamin Eberlei [ beberlei ] Guilherme Blanco [ guilhermeblanco ]
        Resolution Invalid [ 6 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira [ 12984 ] jira-feedback [ 15678 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback [ 15678 ] jira-feedback2 [ 17542 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17542 ] jira-feedback3 [ 19799 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={expand=changesets[0:20].revisions[0:29],reviews, query=DDC-1352}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            guilhermeblanco Guilherme Blanco
            Reporter:
            sorenmh Søren
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: