Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1933

Problem with parameters when clone Doctrine\ORM\QueryBuilder

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3, Git Master
    • Fix Version/s: Git Master
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      Hi, here problem with cloning \Doctrine\ORM\QueryBuilder

      Example
      $queryBuilder = new QueryBuilder($em);
      
      $queryBuilder->setParameter('parameter1', 'value1');
      
      $copy = clone $queryBuilder;
      $copy->setParameter('parameter2', 'value2');
      
      
      count($queryBuilder->getParameters()) // equals 2
      //expects 1
      
      
      

      Solution:

      QueryBuilder
      public function __clone
      {
         ......
      
         $this->parameters = clone $this->parameters;
      }
      

        Activity

        Gandzy Ghennady created issue -
        Marco Pivetta made changes -
        Field Original Value New Value
        Status Open [ 1 ] Awaiting Feedback [ 10000 ]
        Marco Pivetta made changes -
        Status Awaiting Feedback [ 10000 ] In Progress [ 3 ]
        Gandzy Ghennady made changes -
        Description Hi, here problem with cloning \Doctrine\ORM\QueryBuilder

        {code:title=Example}
        $queryBuilder = new QueryBuilder($em);

        $queryBuilder->setParameter('parameter1', 'value1');

        $copy = clone $queryBuilder();
        $copy->setParameter('parameter2', 'value2');


        count($queryBuilder->getParameters()) // equals 2
        //expects 1


        {code}


        Solution:
        {code:title=QueryBuilder}
        public function __clone
        {
           ......

           $this->parameters = clone $this->parameters;
        }
        {code}

        Hi, here problem with cloning \Doctrine\ORM\QueryBuilder

        {code:title=Example}
        $queryBuilder = new QueryBuilder($em);

        $queryBuilder->setParameter('parameter1', 'value1');

        $copy = clone $queryBuilder;
        $copy->setParameter('parameter2', 'value2');


        count($queryBuilder->getParameters()) // equals 2
        //expects 1


        {code}


        Solution:
        {code:title=QueryBuilder}
        public function __clone
        {
           ......

           $this->parameters = clone $this->parameters;
        }
        {code}

        Marco Pivetta made changes -
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        Marco Pivetta made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Fix Version/s Git Master [ 10100 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            Gandzy Ghennady
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: