Admin_ThemesController::assignToPublicationAction PHP Метод

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

    public function assignToPublicationAction()
    {
        $translator = \Zend_Registry::get('container')->getService('translator');
        try {
            $theme = $this->getThemeService()->getById($this->_request->getParam('theme-id'));
            $pub = $this->getPublicationService()->findById($this->_request->getParam('pub-id'));
            if ($this->getThemeService()->assignTheme($theme, $pub)) {
                $this->_helper->service('image.rendition')->reloadRenditions();
                $playlistsService = \Zend_Registry::get('container')->getService('playlists');
                $themePlaylists = $playlistsService->loadThemePlaylists(__DIR__ . '/../../../../themes/' . $theme->getPath() . 'theme.xml');
                $playlistsService->updateThemePlaylists($theme, $themePlaylists);
                $this->view->response = $translator->trans('Assigned successfully', array(), 'themes');
            } else {
                throw new Exception();
            }
        } catch (DuplicateNameException $e) {
            $this->view->exception = array("code" => $e->getCode(), "message" => $translator->trans('Duplicate assignment', array(), 'themes'));
        } catch (\Exception $e) {
            $this->view->exception = array("code" => $e->getCode(), "message" => $translator->trans('Something broke', array(), 'themes'));
        }
    }