Link multiple models at once.

@return $this
342517
public function linkMany() {
        $models = func_get_args();

        if (is_array($models[0])) {
            $models = $models[0];
        }

        foreach ($models as $model) {
            $this->link($model);
        }

        return $this;
    }
499893
public function initForward()
    {
        if (empty($this->_beforeForwardInfo)) {
            $this->_beforeForwardInfo = [
                'params' => $this->getParams(),
                'action_name' => $this->getActionName(),
                'controller_name' => $this->getControllerName(),
                'module_name' => $this->getModuleName()
            ];
        }

        return $this;
    }
712840
public function actionLinkToModel()
    {
        $rr = new RequestResponse();

        if ($rr->isRequestAjaxPost()) {
            try {
                if (!\Yii::$app->request->post('file_id') || !\Yii::$app->request->post('modelId') || !\Yii::$app->request->post('modelClassName') || !\Yii::$app->request->post('modelAttribute')) {
                    throw new \yii\base\Exception("�� ���������� ������� ������");
                }

                $file = CmsStorageFile::findOne(\Yii::$app->request->post('file_id'));
                if (!$file) {
                    throw new \yii\base\Exception("�������� ���� ��� ������ ��� �� ����������");
                }

                if (!is_subclass_of(\Yii::$app->request->post('modelClassName'), ActiveRecord::className())) {
                    throw new \yii\base\Exception("���������� ��������� ���� � ���� ������");
                }

                $className = \Yii::$app->request->post('modelClassName');
                /**
                 * @var $model ActiveRecord
                 */
                $model = $className::findOne(\Yii::$app->request->post('modelId'));
                if (!$model) {
                    throw new \yii\base\Exception("������ � ������� ���������� ��������� ���� �� �������");
                }

                if (!$model->hasAttribute(\Yii::$app->request->post('modelAttribute'))) {
                    throw new \yii\base\Exception("� ������ �� ������ ������� �������� �����: " . \Yii::$app->request->post('modelAttribute'));
                }

                //�������� ������� �����
                if ($oldFileId = $model->{\Yii::$app->request->post('modelAttribute')}) {
                    /**
                     * @var $oldFile CmsStorageFile
                     * @var $file CmsStorageFile
                     */
                    $oldFile = CmsStorageFile::findOne($oldFileId);
                    $oldFile->delete();
                }

                $model->{\Yii::$app->request->post('modelAttribute')} = $file->id;
                if (!$model->save(false)) {
                    throw new \yii\base\Exception("�� ������� ��������� ������");
                }

                $file->name = $model->name;
                $file->save(false);

                $rr->success = true;
                $rr->message = "";

            } catch (\Exception $e) {
                $rr->success = false;
                $rr->message = $e->getMessage();
            }

        }

        return $rr;
    }
1287650
private static function links()
    {
        $files = ['Link'];
        $folder = static::$root.'Http/Links'.'/';

        self::call($files, $folder);

        $files = ['LinkKeyNotFoundException'];
        $folder = static::$root.'Http/Links/Exceptions'.'/';

        self::call($files, $folder);
    }
272028
public function LinkingMode()
    {
        /** @var Page_Controller $controller */
        $controller = Controller::curr();
        $params = $controller->getURLParams();

        return $params['ID'] === $this->URLSegment ? 'current' : 'link';
    }
5434
protected function registerEloquentModels()
    {
        $files = $this->app['files']->files(storage_path('framework/entities'));
        
        foreach ($files as $file) {
            if ($this->app['files']->extension($file) == '') {
                require_once $file;
            }
        }
    }
240386
public function setLinks(array $links)
    {
        $this->links = new ArrayIterator();

        foreach ($links as $linkIdent => $link) {
            $this->addLink($linkIdent, $link);
        }

        return $this;
    }
1311873
protected function linkJoinTable()
    {
        // Join to the many-many join table
        $dataClassIDColumn = DataObject::getSchema()->sqlColumnForField($this->dataClass(), 'ID');
        $this->dataQuery->innerJoin(
            $this->joinTable,
            "\"{$this->joinTable}\".\"{$this->localKey}\" = {$dataClassIDColumn}"
        );

        // Add the extra fields to the query
        if ($this->extraFields) {
            $this->appendExtraFieldsToQuery();
        }
    }
408558
public function unlink(Model $model) {
        $this->getRelation($this->getAlias(get_class($model)))->unlink($model);

        return $this;
    }
524870
private function bindModels()
    {
        $bindings = [
            'users'              => AuthContracts\User::class,
            'roles'              => AuthContracts\Role::class,
            'permissions'        => AuthContracts\Permission::class,
            'permissions-groups' => AuthContracts\PermissionsGroup::class,
        ];

        foreach ($bindings as $key => $contract) {
            $this->bind($contract, $this->config()->get("laravel-auth.$key.model"));
        }
    }
1020794
protected function compose() {
		$context = $this->getContext();
		$this->with( ['global' => View::getGlobals()] );
		View::compose( $this );
		$this->with( $context );
		return $this;
	}
465430
public function buildRelations()
    {
        $this->addRelation('Sport', '\\gossi\\trixionary\\model\\Sport', RelationMap::MANY_TO_ONE, array (
  0 =>
  array (
    0 => ':sport_id',
    1 => ':id',
  ),
), 'CASCADE', null, null, false);
        $this->addRelation('SkillGroup', '\\gossi\\trixionary\\model\\SkillGroup', RelationMap::ONE_TO_MANY, array (
  0 =>
  array (
    0 => ':group_id',
    1 => ':id',
  ),
), 'CASCADE', null, 'SkillGroups', false);
        $this->addRelation('Skill', '\\gossi\\trixionary\\model\\Skill', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Skills');
    }
691763
protected function attachInputs()
    {
        foreach ($this->inputs() as $input) {
            $this->getInputFilter()->add($input);
        }
        return $this;
    }
914060
public function setup_link() {
		$link = get_term_link( $this->term_object->term_id, $this->term_object->taxonomy );
		$this->set_link( $link );
	}
921941
public function initForeignKeys()
    {
        $elems = $this->node->xpath("value[@key='foreignKeys']");
        $this->foreignKeys = $this->getFormatter()->createForeignKeys($this, $elems[0]);

        return $this;
    }
699629
public function linkAttribute($childModel)
    {
        $this->{$childModel} = $this->hasMany(Link::class, 'id_parent')->whereModelParent($this->config->model)->whereModelChild($childModel)->get();

        return $this;
    }
173144
private static function relations()
    {
        $files = ['OneToOne', 'OneToMany', 'ManyToMany', 'BelongsTo'];
        $folder = static::$root.'MVC/Relations'.'/';

        self::call($files, $folder);

        $files = ['ManyRelationException', 'ModelNotFindedException'];
        $folder = static::$root.'MVC/Relations/Exceptions'.'/';

        self::call($files, $folder);
    }