src/ScContent/Controller/Back/CategoryController.php
public function editAction()
    {
        $id = $this->params()->fromRoute('id');
        if (! is_numeric($id)) {
            $this->flashMessenger()->addMessage(
                $this->scTranslate('The category ID was not specified.')
            );
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }

        try {
            $category = $this->getCategoryService()->getCategory($id);
        } catch (RuntimeException $e) {
            $this->flashMessenger()->addMessage($e->getMessage());
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }
        $form = $this->getCategoryForm();
        $form->setAttribute(
            'action',
            $this->url()->fromRoute('sc-admin/category/edit', ['id' => $id])
        );
        $form->bind($category);

        if ($this->getRequest()->isPost()) {
            $form->setData($this->getRequest()->getPost());
            if ($form->isValid()) {
                $this->getCategoryService()->saveContent($form->getData());
            }
        }

        return new ViewModel([
            'content' => $category,
            'form' => $form,
        ]);
    }
public function editAction()
    {
        $id = $this->params()->fromRoute('id');
        if (! is_numeric($id)) {
            $this->flashMessenger()->addMessage(
                $this->scTranslate('The category ID was not specified.')
            );
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }

        try {
            $category = $this->getCategoryService()->getCategory($id);
        } catch (RuntimeException $e) {
            $this->flashMessenger()->addMessage($e->getMessage());
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }
        $form = $this->getCategoryForm();
        $form->setAttribute(
            'action',
            $this->url()->fromRoute('sc-admin/category/edit', ['id' => $id])
        );
        $form->bind($category);

        if ($this->getRequest()->isPost()) {
            $form->setData($this->getRequest()->getPost());
            if ($form->isValid()) {
                $this->getCategoryService()->saveContent($form->getData());
            }
        }

        return new ViewModel([
            'content' => $category,
            'form' => $form,
        ]);
    }
public function editAction ( ) { $ id = $ this -> params ( ) -> fromRoute ( 'id' ) ; if ( ! is_numeric ( $ id ) ) { $ this -> flashMessenger ( ) -> addMessage ( $ this -> scTranslate ( 'The category ID was not specified.' ) ) ; return $ this -> redirect ( ) -> toRoute ( 'sc-admin/content-manager' ) -> setStatusCode ( 303 ) ; } try { $ category = $ this -> getCategoryService ( ) -> getCategory ( $ id ) ; } catch ( RuntimeException $ e ) { $ this -> flashMessenger ( ) -> addMessage ( $ e -> getMessage ( ) ) ; return $ this -> redirect ( ) -> toRoute ( 'sc-admin/content-manager' ) -> setStatusCode ( 303 ) ; } $ form = $ this -> getCategoryForm ( ) ; $ form -> setAttribute ( 'action' , $ this -> url ( ) -> fromRoute ( 'sc-admin/category/edit' , [ 'id' => $ id ] ) ) ; $ form -> bind ( $ category ) ; if ( $ this -> getRequest ( ) -> isPost ( ) ) { $ form -> setData ( $ this -> getRequest ( ) -> getPost ( ) ) ; if ( $ form -> isValid ( ) ) { $ this -> getCategoryService ( ) -> saveContent ( $ form -> getData ( ) ) ; } } return new ViewModel ( [ 'content' => $ category , 'form' => $ form , ] ) ; }
Edit Category.

@return \Zend\Stdlib\ResponseInterface|\Zend\View\Model\ViewModel
Edit Category .