/** * Edits the current block object * * @param array $values An array where keys are the BlockField definition and values are the values to edit * @return boolean * @throws \RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Exception\Content\General\InvalidArgumentTypeException * * @api */ protected function edit(array $values) { $values = $this->dispatchBeforeOperationEvent('\\RedKiteLabs\\RedKiteCms\\RedKiteCmsBundle\\Core\\Event\\Content\\Block\\BeforeBlockEditingEvent', BlockEvents::BEFORE_EDIT_BLOCK, $values, 'exception_block_editing_aborted'); try { $this->validator->checkEmptyParams($values); // Edits the source content $this->blockRepository->startTransaction(); $this->blockRepository->setRepositoryObject($this->alBlock); $result = $this->blockRepository->save($values); if (false !== $result) { $this->blockRepository->commit(); $this->eventsHandler->createEvent(BlockEvents::AFTER_EDIT_BLOCK, '\\RedKiteLabs\\RedKiteCms\\RedKiteCmsBundle\\Core\\Event\\Content\\Block\\AfterBlockEditedEvent', array($this))->dispatch(); return $result; } $this->blockRepository->rollBack(); return $result; } catch (\Exception $e) { if (isset($this->blockRepository) && $this->blockRepository !== null) { $this->blockRepository->rollBack(); } throw $e; } }