示例#1
0
 /**
  * Track a list of blocks for a collection
  * @param \Concrete\Core\Page\Collection\Collection $collection
  * @param Block[]|BlockController[] $blocks
  */
 private function trackBlocks(Collection $collection, array $blocks)
 {
     $version = $collection->getVersionID();
     $buffer = 0;
     foreach ($blocks as $block) {
         if ($block instanceof Controller) {
             $controller = $block;
             $block = $controller->getBlockObject();
         }
         if ($block->getBlockTypeHandle() == BLOCK_HANDLE_STACK_PROXY) {
             if (!$controller) {
                 $controller = $block->getController();
             }
             $this->persist($controller->getStackID(), $collection->getCollectionID(), $version, $block->getBlockID());
             $buffer++;
         }
         if ($buffer > 2) {
             $this->manager->flush();
             $buffer = 0;
         }
     }
     if ($buffer) {
         // Sometimes you just need an extra flush...
         $this->manager->flush();
     }
 }
示例#2
0
 public function getVersionID()
 {
     return parent::getVersionID();
 }