Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: Git Master
    • Fix Version/s: None
    • Component/s: ORM
    • Labels:
      None

      Description

      cascadeRemove incorrect work

      UnitOfWork

      in commit() (336)

      // Entity deletions come last and need to be in reverse commit order
      if ($this->entityDeletions) {
      for ($count = count($commitOrder), $i = $count - 1; $i >= 0; --$i)

      { $this->executeDeletions($commitOrder[$i]); }

      }

      ----------------------------------------------------------------
      in doRemove (1630)

      // Cascade first, because scheduleForDelete() removes the entity from the identity map, which
      // can cause problems when a lazy proxy has to be initialized for the cascade operation.
      $this->cascadeRemove($entity, $visited);

      ......

      $this->scheduleForDelete($entity);

      in array we get

      child
      child
      parent

      revert in commit - first remove parent and get foregein key error

      if move cascadeRemove after switch all woork correct

        Activity

        Hide
        Ivan Borzenkov added a comment - - edited
        
        class Domain
        {
        ...
            /**
             * @ORM\OneToMany(targetEntity="Query", mappedBy="domain", cascade={"all"})
             */
            protected $q;
        ...
        }
        
        class Query
        {
        ...
            /**
             * @ORM\ManyToOne(targetEntity="Domain", inversedBy="q")
             */
            protected $domain;
        ...
        }
        

        if remove Domain - get mysql error foreign key

        Show
        Ivan Borzenkov added a comment - - edited class Domain { ... /** * @ORM\OneToMany(targetEntity= "Query" , mappedBy= "domain" , cascade={ "all" }) */ protected $q; ... } class Query { ... /** * @ORM\ManyToOne(targetEntity= "Domain" , inversedBy= "q" ) */ protected $domain; ... } if remove Domain - get mysql error foreign key
        Hide
        Ivan Borzenkov added a comment -

        patch

        Show
        Ivan Borzenkov added a comment - patch

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Ivan Borzenkov
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: