/**
  * Constructor for MyUserTab.
  */
 public function __construct(array $params = array())
 {
     if (!$params['tab_id']) {
         throw new Exception("You cannot create a MyUserTab without an underlying tab id");
     }
     parent::__construct($params);
     $this->base = MyTab::fetch($this->tab_id);
     $this->base->parent($this);
     // override usertab slug with tab slug if it was missing
     if (!$this->slug) {
         $this->slug = $this->base->slug;
     }
 }
 /**
  * Custom constructor to load base meta in addition to userchannel meta.
  */
 public function __construct($params = array())
 {
     if (!$params['channel_id']) {
         throw new Exception("You cannot create a MyUserChannel without an underlying channel id");
     }
     // load meta so we get a proper overlay of:
     //
     //  1. Channel, replaced by...
     //  2. UserChannel, replaced by...
     //  3. $params['meta']
     //
     // TODO: this is slightly inefficient, since we will also load the meta
     // below.
     $this->meta()->load($params['channel_id'], 'MyChannel');
     parent::__construct($params);
     $this->base = MyChannel::fetch($this->channel_id);
     $this->base->parent = $this;
     $this->data['name'] =& $this->base->name;
     $this->data['slug'] =& $this->base->slug;
     $this->data['content_url'] =& $this->base->content_url;
     $this->data['content_text'] =& $this->base->content_text;
 }