public function processUpdate(FormActionEvent $event)
 {
     /** @var \EzSystems\RepositoryForms\Data\Section\SectionUpdateData|\EzSystems\RepositoryForms\Data\Section\SectionCreateData $sectionData */
     $sectionData = $event->getData();
     if ($sectionData->isNew()) {
         $section = $this->sectionService->createSection($sectionData);
     } else {
         $section = $this->sectionService->updateSection($sectionData->section, $sectionData);
     }
     $sectionData->setSection($section);
 }
Beispiel #2
0
 /**
  * Updates a section.
  *
  * @param $sectionId
  *
  * @throws \eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Section
  */
 public function updateSection($sectionId, Request $request)
 {
     $createStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()));
     try {
         return $this->sectionService->updateSection($this->sectionService->loadSection($sectionId), $this->mapToUpdateStruct($createStruct));
     } catch (InvalidArgumentException $e) {
         throw new ForbiddenException($e->getMessage());
     }
 }
 /**
  * Updates the given in the content repository.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to create a section
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the new identifier already exists (if set in the update struct)
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Section $section
  * @param \eZ\Publish\API\Repository\Values\Content\SectionUpdateStruct $sectionUpdateStruct
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Section
  */
 public function updateSection(Section $section, SectionUpdateStruct $sectionUpdateStruct)
 {
     $returnValue = $this->service->updateSection($section, $sectionUpdateStruct);
     $this->signalDispatcher->emit(new UpdateSectionSignal(array('sectionId' => $section->id)));
     return $returnValue;
 }