Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2252

Trying to delete ManyToMany relatrionship with composite keys.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.7, 2.3.2
    • Fix Version/s: 2.4
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Debian
      PHP 5.3.7

      Description

      Hi,

      When i try to delete some entities attached to an entity I've got the following message.

      My entity is specified as follow.

          /**
           * @ORM\Id
           * @ORM\ManyToOne(targetEntity="Entity\User\Account", inversedBy="memberships")
           * @ORM\JoinColumn(name="uid", referencedColumnName="uid")
           */
          protected $userAccount;
      
          /**
           * @ORM\Id
           * @ORM\ManyToOne(targetEntity="Entity\Merchant\Account")
           * @ORM\JoinColumn(name="mch_accountid", referencedColumnName="accountid")
           */
          protected $merchantAccount;
      
          /**
           * @ORM\Column(type="datetime", name="date")
           * @var datetime
           */
          protected $date;
      
          /**
           * @ORM\Column(type="boolean")
           * @var boolean
           */
          protected $administrator;
      
          /**
           * @ORM\ManyToMany(targetEntity="Entity\User\Privilege", indexBy="privilegeid")
           * @ORM\JoinTable(name="fsbackend.user_mch_account_privilege",
           *   joinColumns={
           *       @ORM\JoinColumn(name="mch_accountid", referencedColumnName="mch_accountid"),
           *       @ORM\JoinColumn(name="uid", referencedColumnName="uid")
           *   },
           *   inverseJoinColumns={
           *       @ORM\JoinColumn(name="privilegeid", referencedColumnName="privilegeid")
           *   }
           * )
           */
          protected $privileges;
      

      I delete the related entities

          $membership->getPrivileges()->clear();
      
          $this->_em->persist($userAccount);
          $this->_em->flush();
      

      I tried on doctrine 2.1.7 and the last doctrine version and same thing happens.

      Please find attached the error log.

      1. AdvancedAssociationTest.php
        4 kB
        Jeremie Tom tom
      2. jira-doctrine.txt
        9 kB
        Jeremie Tom tom
      3. patch.diff
        1 kB
        Jeremie Tom tom

        Activity

        Hide
        Jeremie Tom tom added a comment -

        Ok here is my two cents solution. passes the tests.

        Show
        Jeremie Tom tom added a comment - Ok here is my two cents solution. passes the tests.
        Hide
        Jeremie Tom tom added a comment -

        Hi, any update on this issue?

        Show
        Jeremie Tom tom added a comment - Hi, any update on this issue?
        Hide
        Marco Pivetta added a comment -

        Jeremie Tom tom will be checking this tomorrow

        Show
        Marco Pivetta added a comment - Jeremie Tom tom will be checking this tomorrow
        Hide
        Jeremie Tom tom added a comment -

        Everything ok with the check?

        Show
        Jeremie Tom tom added a comment - Everything ok with the check?
        Show
        Fabio B. Silva added a comment - Fixed by : https://github.com/doctrine/doctrine2/commit/cef20890dc75c11880827226e25f3fc6d5d66127

          People

          • Assignee:
            Fabio B. Silva
            Reporter:
            Jeremie Tom tom
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: