private function _update_similar($old_hash, $new_hash, $settings) { // find all similar blocks $blocks_collection = $this->block_mapper->find(array('hash' => $old_hash)); $blocks = array(); foreach ($blocks_collection as $entity) { $entity->set_hash($new_hash); $entity->set_settings($settings); $this->block_mapper->save($entity); $blocks[$entity->get_bid()] = $this->render_block($entity); } return $blocks; }
/** * Delete all instances of a block across styles/routes */ public function delete_blocks_by_name($block_name) { $collection = $this->block_mapper->find(array('name' => $block_name)); foreach ($collection as $entity) { $this->block_mapper->delete($entity); } }