public function setUp()
 {
     parent::setUp();
     $this->hasOne($this->_options['table']->getComponentName(), array('local' => 'post_id', 'foreign' => 'id', 'onDelete' => 'cascade'));
     $this->hasOne('File', array('local' => 'file_id', 'foreign' => 'id', 'onDelete' => 'cascade'));
     $this->addListener(new opCommunityTopicPluginImagesListener($this->_options));
 }
コード例 #2
0
 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();
 }
コード例 #3
0
ファイル: Search.php プロジェクト: tests1/zendcasts
 public function buildTable()
 {
     $result = parent::buildTable();
     if (!isset($this->_options['connection'])) {
         $this->_options['connection'] = $this->_options['table']->getConnection();
     }
     return $result;
 }
コード例 #4
0
ファイル: Search.php プロジェクト: dennybrandes/doctrine1
 public function buildTable()
 {
     $result = parent::buildTable();
     if (!isset($this->_options['connection'])) {
         $manager = Doctrine_Manager::getInstance();
         $this->_options['connection'] = $manager->getConnectionForComponent($this->_options['table']->getComponentName());
         $manager->bindComponent($this->_options['className'], $this->_options['connection']->getName());
     }
     return $result;
 }
コード例 #5
0
 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();
 }
コード例 #6
0
ファイル: Abstract.php プロジェクト: JimmyVB/Symfony-v1.2
 public function loadGenerator(Doctrine_Record_Generator $generator)
 {
     $generator->initialize($this->_table);
     $this->_table->addGenerator($generator, get_class($generator));
 }
コード例 #7
0
ファイル: Template.php プロジェクト: stelaireri/Hive
 /**
  * Adds a plugin as a child to this plugin
  * 
  * @param Doctrine_Template $template 
  * @return Doctrine_Template. Chainable.
  */
 public function addChild(Doctrine_Template $template)
 {
     $this->_plugin->addChild($template);
     return $this;
 }
コード例 #8
0
ファイル: DmGallery.php プロジェクト: theolymp/diem
 public function generateClass(array $definition = array())
 {
     $definition['inheritance']['extends'] = 'myDoctrineRecord';
     return parent::generateClass($definition);
 }