Sets the child Scope for this Directive.

Sets the child Scope for this Directive and also
sets the $childScope->setParentDirective($this).

@param Scope $childScope
@return $this
345539
public function setChildScope(Scope $childScope)
    {
        $this->childScope = $childScope;

        if ($childScope->getParentDirective() !== $this) {
            $childScope->setParentDirective($this);
        }

        return $this;
    }
368588
public function push($scope)
    {
        if (! is_array($scope)) {
            $scope = func_get_args();
        }

        $this->scopes[] = $scope;

        return $this;
    }
729338
public function addScope($scope, $parameters = [])
    {
        if ( ! in_array($scope, $this->scopes)) {

            $this->scopes[] = $scope;
        }

        $this->scopeParameters[ $scope ] = $parameters;

        $this->refreshSettingDependentCriteria();
        return $this;
    }
615360
public void setParentScope(Scope parentScope) {
        this.parentScope = parentScope;
        this.top = parentScope == null ? (ScriptNode)this : parentScope.top;
    }
1068454
public function setChildOf(Tree $parent)
    {
        if ($parent->type->name !== 'category') {
            throw new DomainException("Content can be assigned only to category parent");
        }
        return parent::setChildOf($parent);
    }
530225
public void init() {
        log.debug("Init scope: {} parent: {}", name, parent);
        if (hasParent()) {
            if (!parent.hasChildScope(name)) {
                if (parent.addChildScope(this)) {
                    log.debug("Scope added to parent");
                } else {
                    log.warn("Scope not added to parent");
                    //throw new ScopeException("Scope not added to parent");
                    return;
                }
            } else {
                throw new ScopeException("Scope already exists in parent");
            }
        } else {
            log.debug("Scope has no parent");
        }
        if (autoStart) {
            start();
        }
    }
1163086
public function addScopeFilter($scope, $scopeCode, $section)
    {
        $this->addFieldToFilter('scope', $scope);
        $this->addFieldToFilter('scope_code', trim($scopeCode));
        $this->addFieldToFilter('path', ['like' => $section . '/%']);

        return $this;
    }
1098197
public function withGlobalScope( $identifier, $scope )
	{
		$this->scopes[$identifier] = $scope;

		if ( method_exists( $scope, 'extend' ) )
			$scope->extend( $this );

		return $this;
	}
1106374
public function setScope($scope, $key, $value)
    {
        $this->version++;
        $this->data[$scope][$key] = $value;
        return $this;
    }
306301
public function setScope($scope)
    {
        if (!in_array($scope, self::SCOPE_ALL, true)) {
            throw new InvalidArgumentException();
        }

        if (is_array($scope)) {
            $this->scope = $scope;
        }

        $this->scope[] = $scope;

        return $this;
    }
406111
public function setPermissionRelatedByParentId(ChildPermission $v = null)
    {
        if ($v === null) {
            $this->setParentId(NULL);
        } else {
            $this->setParentId($v->getId());
        }

        $this->aPermissionRelatedByParentId = $v;

        // Add binding for other direction of this n:n relationship.
        // If this object has already been added to the ChildPermission object, it will not be re-added.
        if ($v !== null) {
            $v->addPermissionRelatedById($this);
        }


        return $this;
    }
1135964
public function update(Queries\IScope $scope)
    {
        if ($this->scope === $scope) {
            return $this;
        }

        return new self($scope);
    }
902631
public function compose(Resource $resource, $scopeIdentifier = null, Scope $parentScopeInstance = null)
    {
        $scopeInstance = new Scope($this, $resource, $scopeIdentifier);

        // Update scope history
        if ($parentScopeInstance !== null) {

            // This will be the new children list of parents (parents parents, plus the parent)
            $scopeArray = $parentScopeInstance->getParentScopes();
            $scopeArray[] = $parentScopeInstance->getCurrentScope();

            $scopeInstance->setParentScopes($scopeArray);
        }

        return $scopeInstance;
    }
197627
public function setParent($parent){

            $this->parent = $parent;

            if($this->parentCallback){
                call_user_func($this->parentCallback);
            }

            return $this;

        }
969161
public function setParent(LeafRole $parent = null)
    {
        if ($parent && !$parent->getChildren()->contains($this)) {
            $parent->addChild($this);
        }
        $this->parent = $parent;

        return $this;
    }
960909
public function withScope($scope)
    {
        if ($scope == Grid\Exporter::SCOPE_ALL) {
            return $this;
        }

        list($scope, $args) = explode(':', $scope);

        if ($scope == Grid\Exporter::SCOPE_CURRENT_PAGE) {
            $this->grid->model()->usePaginate(true);
        }

        if ($scope == Grid\Exporter::SCOPE_SELECTED_ROWS) {
            $selected = explode(',', $args);
            $this->grid->model()->whereIn($this->grid->getKeyName(), $selected);
        }

        return $this;
    }
239876
public function buildScopes()
	{
		$this->setScopeMapper(new ScopeMapper);
		$this->configureScopes($this->getScopeMapper());

		$this->setScopeBuilder(new FilterBuilder($this->getScopeMapper()));
		$this->getScopeBuilder()
			->build();

		return $this;
	}