Skip to content

Commit

Permalink
Fixes a caching error in BlockTypes Service
Browse files Browse the repository at this point in the history
  • Loading branch information
joshangell committed Jul 2, 2018
1 parent 44bc8cc commit 015d734
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/services/BlockTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,14 @@ public function save(BlockType $blockType)
try {

// Save it!
$isNew = $blockTypeRecord->getIsNewRecord();
$blockTypeRecord->save(false);
if ($isNew) {
$blockType->id = $blockTypeRecord->id;
}

// Might as well update our cache of the block type group while we have it.
$this->_blockTypesByContext[$blockType->context] = $blockType;
$this->_blockTypesByContext[$blockType->context][$blockType->id] = $blockType;

$transaction->commit();

Expand Down

0 comments on commit 015d734

Please sign in to comment.