Merge relations conditions.
Returns a clone of $this with merged conditions from $other.

@return Relation
763426
public function merge(self $other)
    {
        $new      = clone $this;
        $newWhere = $new->select->where;
        
        foreach ($other->select->where->getPredicates() as $pData) {
            $newWhere->addPredicate($pData[1], $pData[0]);
        }
        
        return $new;
    }
199945
public Curies mergeWith(final Curies other) {
        final Curies merged = copyOf(this);
        other.curies.forEach(merged::register);
        return merged;
    }
441012
public function merge(Set $rules): self
    {
        $this->rules = array_merge($this->rules, $rules->rules);
        return $this;
    }
1054346
public function mergeWith(self $specs): self
    {
        $clone = clone $this;
        if (null === $clone->constructor) {
            $clone->constructor = $specs->constructor;
        }
        
        $clone->properties = $this->properties->mergeWith($specs->properties);
        $clone->calls = $this->calls->mergeWith($specs->calls);

        return $clone;
    }
1120547
public function join()
	{
		// We do a left outer join here because we're not trying to limit the primary table's results
		// This function is primarily used when needing to sort by a field in the joined table
		$this->model->select($this->model->getQualifiedFieldName('*'))
		            ->join($this->related->getTableName(),
		                   $this->model->getQualifiedFieldName($this->localKey),
		                   $this->related->getQualifiedFieldName($this->relatedKey),
		                   'LEFT OUTER');

		return $this;
	}
624991
public function joinRelations($relations, $type = 'inner')
    {
        if (is_null($this->joiner)) {
            $this->joiner = static::$joinerFactory->make($this);
        }

        if (!is_array($relations)) {
            list($relations, $type) = [func_get_args(), 'inner'];
        }

        foreach ($relations as $relation) {
            $this->joiner->join($relation, $type);
        }

        return $this;
    }
272406
public static function union(self $a, self $b): self
    {
        return new self(array_merge($a->toArray(), $b->toArray()));
    }
824406
public function update($other){
        if(is_array($other)){
            $this->_array = $other;
            return $this;
        }
        $this->_array = array();
        foreach($other as $key=>$value){
            $this->_array[$key] = $value;
        }
        return $this;
    }
139332
public function leftJoinRelations($relations)
    {
        $relations = is_array($relations) ? $relations : func_get_args();

        return $this->joinRelations($relations, 'left');
    }
775346
public function Join()
    {
        // Check Join type
        $joinType = AST\Join::JOIN_TYPE_INNER;

        switch (true) {
            case $this->lexer->isNextToken(Lexer::T_LEFT):
                $this->match(Lexer::T_LEFT);

                $joinType = AST\Join::JOIN_TYPE_LEFT;

                // Possible LEFT OUTER join
                if ($this->lexer->isNextToken(Lexer::T_OUTER)) {
                    $this->match(Lexer::T_OUTER);

                    $joinType = AST\Join::JOIN_TYPE_LEFTOUTER;
                }
                break;

            case $this->lexer->isNextToken(Lexer::T_INNER):
                $this->match(Lexer::T_INNER);
                break;

            default:
                // Do nothing
        }

        $this->match(Lexer::T_JOIN);

        $next            = $this->lexer->glimpse();
        $joinDeclaration = $next['type'] === Lexer::T_DOT ? $this->JoinAssociationDeclaration() : $this->RangeVariableDeclaration();
        $adhocConditions = $this->lexer->isNextToken(Lexer::T_WITH);
        $join            = new AST\Join($joinType, $joinDeclaration);

        // Describe non-root join declaration
        if ($joinDeclaration instanceof AST\RangeVariableDeclaration) {
            $joinDeclaration->isRoot = false;
        }

        // Check for ad-hoc Join conditions
        if ($adhocConditions) {
            $this->match(Lexer::T_WITH);

            $join->conditionalExpression = $this->ConditionalExpression();
        }

        return $join;
    }
487092
public function mapRelatives()
    {
        $relations = collect($this->relations());

        if ($relations->isEmpty()) {
            return false;
        }

        return $this->items = collect($this->all())
            ->map(function ($value, $key) use ($relations) {
                if ($relations->has($key)) {
                    $className = $relations->get($key);

                    return new $className($value);
                }

                return $value;
            })
            ->all();
    }
1208833
public function having($conditions): self
    {
        if ($conditions[0] instanceof Closure) {
            $this->addClauseCondClosure('having', 'AND', $conditions[0]);

            return $this;
        }
        $this->having[] = ['and', $conditions];

        return $this;
    }
18596
public function getSymmetricalRelation()
    {
        $localMapping = [$this->getLeftColumns(), $this->getRightColumns()];
        foreach ($this->getRightTable()->getRelations() as $relation) {
            if ($localMapping == [$relation->getRightColumns(), $relation->getLeftColumns()]) {
                return $relation;
            }
        }
    }
284292
public function merge ()
	{
		$args = func_get_args();
		$a    = new SObject();

		// TODO: fix for actual Object

		foreach ($args as $arg) {
			if (is_an_array($arg)) {
				if ($arg instanceof self) {
					$arg = $arg->to_array();
				}

				foreach ($arg as $key => $value) {
					$key = strtolower($key);

					if (!$a->offsetExists($key)) {
						$a->offsetSet($key, $value);
					}
				}
			} else {
				/* XXX: Do we really support this? Object instances are
				 *      supposed to be hashes, Vector instances can be appended
				 *      to. */
				$a->storage []= $arg;
			}
		}

		return $a;
	}
897699
protected function carryOverIncompatibleQueries()
    {
        foreach ($this->filters['strata_relations'] as $queryType => $queryDetails) {
            if ($this->hasRelationQuery($queryType, 'AND') && $this->hasRelationQuery($queryType, 'OR')) {
                $this->andRelationToPostIn($queryType);
            }
        }

        return $this;
    }
346622
public function mergeConditions( ConditionInterface $old, ConditionInterface $new ) {
		if ( $old instanceof UrlCondition && $new instanceof UrlCondition ) {
			return $old->concatenate( $new->getUrl(), $new->getUrlWhere() );
		}

		return $this->makeFromArrayOfConditions( [$old, $new] );
	}
1248173
public function mergeWith(self $flags, bool $override = true): self
    {
        if ($override) {
            $clone = clone ($this);
            foreach ($flags as $stringFlag => $flag) {
                /** @var FlagInterface $flag */
                $clone->flags[$flag->__toString()] = clone ($flag);
            }
        } else {
            $clone = clone ($flags);
            $clone->key = $this->key;
            foreach ($this as $stringFlag => $flag) {
                /** @var FlagInterface $flag */
                $clone->flags[$flag->__toString()] = clone ($flag);
            }
        }

        return $clone;
    }