Esempio n. 1
0
 /**
  * @param WorkspaceModel $model
  * @return array
  */
 public function toArray(WorkspaceModel $model)
 {
     $array = [];
     $array['name'] = $model->getName();
     return $array;
 }
Esempio n. 2
0
 /**
  * @param Workspace $workspace
  *
  * @EXT\Route(
  *     "/{model}/rename",
  *     name="claro_workspace_model_rename",
  *     options = {"expose"=true}
  * )
  */
 public function renameModelAction(WorkspaceModel $model)
 {
     $this->checkAccess($model->getWorkspace());
     $oldName = $model->getName();
     $form = $this->formFactory->create(new ModelType(), $model);
     $form->handleRequest($this->request);
     if ($form->isValid()) {
         $model = $this->modelManager->edit($model, $form->get('name')->getData());
         return new JsonResponse(array('id' => $model->getId(), 'name' => $model->getName()));
     }
     $action = $this->router->generate('claro_workspace_model_rename', array('model' => $model->getId()));
     return $this->render('ClarolineCoreBundle:Tool\\workspace\\parameters\\model:modelModalForm.html.twig', array('form' => $form->createView(), 'action' => $action, 'title' => 'rename'));
 }