protected function getBlockId(Block $block) { if (!$this->blocks->contains($block)) { $this->blocks[$block] = count($this->blocks) + 1; } return $this->blocks[$block]; }