当前位置: 首页>>代码示例>>PHP>>正文


PHP Doctrine_Record::getNode方法代码示例

本文整理汇总了PHP中Doctrine_Record::getNode方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Record::getNode方法的具体用法?PHP Doctrine_Record::getNode怎么用?PHP Doctrine_Record::getNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine_Record的用法示例。


在下文中一共展示了Doctrine_Record::getNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createRoot

 /**
  * Creates root node from given record or from a new record.
  *
  * Note: When using a tree with multiple root nodes (hasManyRoots), you MUST pass in a
  * record to use as the root. This can either be a new/transient record that already has
  * the root id column set to some numeric value OR a persistent record. In the latter case
  * the records id will be assigned to the root id. You must use numeric columns for the id
  * and root id columns.
  *
  * @param object $record        instance of Doctrine_Record
  */
 public function createRoot(Doctrine_Record $record = null)
 {
     if ($this->getAttribute('hasManyRoots')) {
         if (!$record || !$record->exists() && $record->getNode()->getRootValue() <= 0 || $record->getTable()->isIdentifierComposite()) {
             throw new Doctrine_Tree_Exception("Node must have a root id set or must " . " be persistent and have a single-valued numeric primary key in order to" . " be created as a root node. Automatic assignment of a root id on" . " transient/new records is no longer supported.");
         }
         if ($record->exists() && $record->getNode()->getRootValue() <= 0) {
             // Default: root_id = id
             $identifier = $record->getTable()->getIdentifier();
             $record->getNode()->setRootValue($record->get($identifier));
         }
     }
     if (!$record) {
         $record = $this->table->create();
     }
     $record->set('lft', '1');
     $record->set('rgt', '2');
     $record->set('level', 0);
     $record->save();
     return $record;
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:32,代码来源:NestedSet.php

示例2: isAncestorOf

 /**
  * determines if node is ancestor of subject node
  *
  * @return bool            
  */
 public function isAncestorOf(Doctrine_Record $subj)
 {
     return $subj->getNode()->getLeftValue() > $this->getLeftValue() && $subj->getNode()->getRightValue() < $this->getRightValue() && $subj->getNode()->getRootValue() == $this->getRootValue();
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:9,代码来源:NestedSet.php

示例3: isDescendantOfOrEqualTo

 /**
  * determines if node is child of or sibling to subject node
  *
  * @return bool            
  */
 public function isDescendantOfOrEqualTo(Doctrine_Record $subj)
 {
     return $this->getLeftValue() >= $subj->getNode()->getLeftValue() && $this->getRightValue() <= $subj->getNode()->getRightValue() && $this->getRootValue() == $subj->getNode()->getRootValue();
 }
开发者ID:hasanozgan,项目名称:kissabe,代码行数:9,代码来源:NestedSet.php

示例4: isValidNode

 /**
  * determines if node is valid
  *
  * @return bool            
  */
 public function isValidNode(Doctrine_Record $record = null)
 {
     if ($record === null) {
         return $this->getRightValue() > $this->getLeftValue();
     } else {
         return $record->getNode()->getRightValue() > $record->getNode()->getLeftValue();
     }
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:13,代码来源:NestedSet.php


注:本文中的Doctrine_Record::getNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。