Nelmio\Alice\ObjectBag::mergeWith PHP 메소드

mergeWith() 공개 메소드

Creates a new instance with the new objects. If objects with the same reference already exists, they will be overridden by the new ones.
public mergeWith ( self $objects ) : self
$objects self
리턴 self
    public function mergeWith(self $objects) : self
    {
        $clone = clone $this;
        foreach ($objects->objects as $reference => $object) {
            $clone->objects[$reference] = $object;
            $clone->array[$reference] = $object->getInstance();
        }
        return $clone;
    }