#DDC-2313: QueryBuilder Deep Cloning #327

Merged
merged 1 commit into from Jun 13, 2013

3 participants

@pmen

No description provided.

@Ocramius Ocramius commented on the diff May 30, 2013
lib/Doctrine/DBAL/Query/QueryBuilder.php
+ {
+ foreach ($this->sqlParts as $part => $elements) {
+ if (is_array($this->sqlParts[$part])) {
+ foreach ($this->sqlParts[$part] as $idx => $element) {
+ if (is_object($element)) {
+ $this->sqlParts[$part][$idx] = clone $element;
+ }
+ }
+ } else if (is_object($elements)) {
+ $this->sqlParts[$part] = clone $elements;
+ }
+ }
+
+ $params = array();
+
+ foreach ($this->params as $param) {
@Ocramius
Doctrine member
Ocramius added a line comment May 30, 2013

Could be simplified:

foreach ($this->params as $key => $param) {
    if (is_object($param)) {
        $this->params[$key] = clone $param;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@beberlei beberlei merged commit 1c5d14b into doctrine:master Jun 13, 2013

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment