/**
     * @return ChannelBlock[]
     */
    public function getChannelBlocks()
    {
        $blocks = array();
        $channelHasBlocks = ChannelHasBlock::fetchBlocksByApplicationLocalized($this->attribute("id"));

        /** @var ChannelBlock $hasBlock */
        foreach($channelHasBlocks as $hasBlock)
        {
            if($hasBlock)
            {
                $blocks[] = ChannelBlock::fetchById( $hasBlock->attribute("block_id") );
            }
        }

        return $blocks;
    }
 /**
  * Allow to set channel and channelBlockId from view parameters in url : (channel)/131
  */
 protected function initChannelInformations()
 {
     $parameters = $this->_params['UserParameters'];
     if($parameters && $parameters["channel"])
     {
         $block = ChannelBlock::fetchById($parameters["channel"]);
         if($block instanceof ChannelBlock)
         {
             $this->channel = $block->getChannelApplicationLocalized();
             $this->channelBlockId = $parameters["channel"];
         }
     }
     else if ($this->getCustomParameter('ParentChannel') !== false)
     {
         $channelIdentifier = $this->getCustomParameter('ParentChannel');
         $channel = ApplicationLocalized::getLocalizedApplicationByIdentifier($channelIdentifier);
         if ($channel != null && $channel instanceof ApplicationLocalized)
         {
             $this->channel = $channel;
         }
     }
 }