code: public function setBlocks(ArrayCollection $blocks)
      {
          $this->blocks->clear();
          foreach ($blocks as $block) {
              $this->blocks->add($block);
          }
      }
docs: Set blocks
  
  @param ArrayCollection $blocks