/**
  * @param CommentCommand $command
  * @param $callback
  * @param Ticket $ticket
  * @return array
  */
 private function edit(CommentCommand $command, $callback, Ticket $ticket)
 {
     $response = null;
     $form = $this->createForm(new CommentType(), $command);
     $formView = $form->createView();
     $formView->children['attachmentsInput']->vars = array_replace($formView->children['attachmentsInput']->vars, array('full_name' => 'diamante_comment_form[attachmentsInput][]'));
     try {
         $this->handle($form);
         $callback($command);
         if ($command->id) {
             $this->addSuccessMessage('diamante.desk.comment.messages.save.success');
         } else {
             $this->addSuccessMessage('diamante.desk.comment.messages.create.success');
         }
         $response = $this->getSuccessSaveResponse((string) $ticket->getKey());
     } catch (MethodNotAllowedException $e) {
         $response = array('form' => $formView, 'ticket' => $ticket);
     } catch (\Exception $e) {
         $this->container->get('monolog.logger.diamante')->error(sprintf('Comment saving failed: %s', $e->getMessage()));
         $this->addErrorMessage('diamante.desk.comment.messages.create.error');
         $response = array('form' => $formView, 'ticket' => $ticket);
     }
     return $response;
 }
 /**
  * @param CommentCommand $command
  * @param $callback
  * @param Ticket $ticket
  * @return array
  */
 private function edit(CommentCommand $command, $callback, Ticket $ticket)
 {
     $response = null;
     $form = $this->createForm('diamante_comment_form', $command);
     $formView = $form->createView();
     $formView->children['attachmentsInput']->vars = array_replace($formView->children['attachmentsInput']->vars, array('full_name' => 'diamante_comment_form[attachmentsInput][]'));
     try {
         $this->handle($form);
         $callback($command);
         if ($command->id) {
             $this->addSuccessMessage('diamante.desk.comment.messages.save.success');
         } else {
             $this->addSuccessMessage('diamante.desk.comment.messages.create.success');
         }
         $response = $this->getSuccessSaveResponse('diamante_comment_update', 'diamante_ticket_view', ['key' => (string) $ticket->getKey()]);
     } catch (\Exception $e) {
         $this->handleException($e);
         $response = array('form' => $formView, 'ticket' => $ticket);
     }
     return $response;
 }