Ejemplo n.º 1
0
 /**
  * @param $block
  * @param $historyType
  */
 public function saveHistory($block, $historyType)
 {
     $blockHistory = new \Fraym\Block\Entity\BlockHistory();
     $blockHistory = $block->copyEntityTo($blockHistory);
     $blockHistory->user = $this->user->getUserEntity();
     $blockHistory->type = $historyType;
     $blockHistory = $this->setHistoryFrom($blockHistory, $block, $historyType);
     $this->db->persist($block);
     $this->db->persist($blockHistory);
     $this->db->flush();
 }
Ejemplo n.º 2
0
 /**
  * @param $changedBlock
  * @param $parentBlock
  * @param $type
  * @return Entity\ChangeSet
  */
 protected function createChangeSet($changedBlock, $parentBlock, $type)
 {
     $changeSet = new \Fraym\Block\Entity\ChangeSet();
     $changeSet->contentId = $changedBlock->contentId;
     $changeSet->position = $changedBlock->position;
     $changeSet->menuItem = $changedBlock->menuItem;
     $changeSet->site = $changedBlock->site;
     $changeSet->menuItemTranslation = $changedBlock->menuItemTranslation;
     $changeSet->extension = $changedBlock->extension;
     $changeSet->user = $this->user->getUserEntity();
     $changeSet->byRef = $changedBlock->byRef;
     $changeSet->block = $parentBlock;
     $changeSet->type = $type;
     if (!$changedBlock->byRef) {
         $changeSet->config = $changedBlock->config;
     }
     $this->db->persist($changeSet);
     $this->db->flush();
     return $changeSet;
 }