public function copyAction()
    {
        $this->getResponse()->setTypeJson();
        if (null === $category = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->getPost()->id)) {
            return json_encode(['status' => false, 'error' => 'Strona nie istnieje']);
        }
        //model do kopiowania kategorii
        $copyModel = new \Cms\Model\CategoryCopy($category);
        //kopiowanie z transakcją
        if ($copyModel->copyWithTransaction()) {
            return json_encode(['status' => true, 'id' => $copyModel->getCopyRecord()->id, 'message' => $this->view->_('controller.category.copy.message')]);
        }
        return json_encode(['status' => false, 'error' => $this->view->_('controller.category.copy.error')]);
    }
public function copyAction()
    {
        $this->getResponse()->setTypeJson();
        if (null === $category = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->getPost()->id)) {
            return json_encode(['status' => false, 'error' => 'Strona nie istnieje']);
        }
        //model do kopiowania kategorii
        $copyModel = new \Cms\Model\CategoryCopy($category);
        //kopiowanie z transakcją
        if ($copyModel->copyWithTransaction()) {
            return json_encode(['status' => true, 'id' => $copyModel->getCopyRecord()->id, 'message' => $this->view->_('controller.category.copy.message')]);
        }
        return json_encode(['status' => false, 'error' => $this->view->_('controller.category.copy.error')]);
    }
public function copyAction ( ) { $ this -> getResponse ( ) -> setTypeJson ( ) ; if ( null === $ category = ( new \ Cms \ Orm \ CmsCategoryQuery ) -> findPk ( $ this -> getPost ( ) -> id ) ) { return json_encode ( [ 'status' => false , 'error' => 'Strona nie istnieje' ] ) ; } //model do kopiowania kategorii $ copyModel = new \ Cms \ Model \ CategoryCopy ( $ category ) ; //kopiowanie z transakcją if ( $ copyModel -> copyWithTransaction ( ) ) { return json_encode ( [ 'status' => true , 'id' => $ copyModel -> getCopyRecord ( ) -> id , 'message' => $ this -> view -> _ ( 'controller.category.copy.message' ) ] ) ; } return json_encode ( [ 'status' => false , 'error' => $ this -> view -> _ ( 'controller.category.copy.error' ) ] ) ; }
Kopiowanie strony - kategorii
Kopiowanie strony - kategorii