public function buildRelation()
 {
     $options = array('local' => 'tag_id', 'foreign' => 'id', 'onDelete' => 'CASCADE', 'onUpdate' => 'CASCADE');
     $this->_table->bind(array($this->_options['tagClass'], $options), Doctrine_Relation::ONE);
     $options = array('local' => 'id', 'foreign' => 'tag_id', 'refClass' => $this->getOption('table')->getComponentName() . $this->_options['tagClass']);
     $this->getOption('table')->bind(array($this->_options['tagClass'] . ' as ' . $this->_options['tagAlias'], $options), Doctrine_Relation::MANY);
     parent::buildRelation();
 }
 public function buildRelation()
 {
     $this->addCommentable($this->getOption('table')->getComponentName());
     // Set index on Comment Table
     $options = array('local' => 'comment_id', 'foreign' => 'id', 'onDelete' => 'CASCADE', 'onUpdate' => 'CASCADE');
     $this->_table->bind(array($this->_options['commentClass'], $options), Doctrine_Relation::ONE);
     //Set index on Commentable Object Table
     $options = array('local' => 'id', 'foreign' => 'comment_id', 'refClass' => $this->getOption('table')->getComponentName() . $this->_options['commentClass']);
     $this->getOption('table')->bind(array($this->_options['commentClass'] . ' as ' . $this->_options['commentAlias'], $options), Doctrine_Relation::ONE);
     parent::buildRelation();
 }