Backend\Modules\Pages\Actions\Copy::execute PHP Метод

execute() публичный Метод

Execute the action
public execute ( )
    public function execute()
    {
        // call parent, this will probably add some general CSS/JS or other required files
        parent::execute();
        // get parameters
        $this->from = $this->getParameter('from');
        $this->to = $this->getParameter('to');
        // validate
        if ($this->from == '') {
            throw new BackendException('Specify a from-parameter.');
        }
        if ($this->to == '') {
            throw new BackendException('Specify a to-parameter.');
        }
        // copy pages
        BackendPagesModel::copy($this->from, $this->to);
        // redirect
        $this->redirect(BackendModel::createURLForAction('Index') . '&report=copy-added&var=' . rawurlencode($this->to));
    }