Changeset 1082 for trunk/generator

Show
Ignore:
Timestamp:
09/17/08 14:11:31 (3 months ago)
Author:
tony
Message:

Refs #683: Added support for PHP 5.3 namespaces

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk

    • Property svn:ignore set to
      .project
      .cache
      .settings
  • trunk/generator/classes/propel/engine/builder/om/OMBuilder.php

    r1068 r1082  
    3131 * 
    3232 * @author     Hans Lellelid <hans@xmpl.org> 
     33 * @author     Tony Bibbs <tony@tonybibbs.com> 
    3334 * @package    propel.engine.builder.om 
     35 * @todo       Explore if the methods listed in build() shouldn't be defined formally in an 
     36 *             interface 
    3437 */ 
    3538abstract class OMBuilder extends DataModelBuilder { 
    36  
     39        const NAMESPACE_GLOBAL = 1; 
     40        const NAMESPACE_OM = 2; 
     41        const NAMESPACE_PEER = 3; 
     42        const NAMESPACE_MAP = 4; 
     43         
     44        /** 
     45         * Generated code needs to behave differently if we are using 5.3+ namespaces 
     46         * 
     47         * NOTE: this works gracefully if user has disabled namespaces in their properties file. 
     48         *  
     49         * @access protected 
     50         * @return string Either empty string when we aren't using namepaces or :: if we are. 
     51         *  
     52         */ 
     53    protected function getNamespaceQualifier($nameSpaceToGet = self::NAMESPACE_GLOBAL) 
     54    { 
     55        if ($this->getBuildProperty('namespaceEnabled') <> 1) return ''; 
     56        switch ($nameSpaceToGet) { 
     57                case self::NAMESPACE_GLOBAL: 
     58                        return '::'; 
     59                case self::NAMESPACE_MAP: 
     60                        return $this->getBuildProperty('namespaceMap') . '::'; 
     61                case self::NAMESPACE_OM: 
     62                        return $this->getBuildProperty('namespaceOm') . '::'; 
     63                case self::NAMESPACE_PEER: 
     64                        return $this->getBuildProperty('namespacePeer') . '::'; 
     65                default: 
     66                        throw new Exception('Invalid namespace given'); 
     67        } 
     68    } 
     69     
     70        /** 
     71         * Gets the base peer classname with fully qualified namespace. 
     72         * 
     73         * @access protected 
     74         * @return string fully qualified classname. 
     75         *  
     76         */ 
     77        protected function getNamespaceQualifiedBasePeer() 
     78        { 
     79                if ($this->getBuildProperty('namespaceEnabled') <> 1) return $this->basePeerClassname; 
     80                if ($this->basePeerClassname == 'BasePeer') return '::BasePeer'; 
     81                return $this->getNamspaceQualifier(self::NAMESPACE_PEER) . $this->basePeerClassname; 
     82        } 
     83         
     84        /** 
     85         * Takes a class name and prepends the namespace. 
     86         *  
     87         * NOTE: this is probably not fail proof 
     88         *  
     89         * @access protected 
     90         * @param       $clsName        string  Name of class to prepend namespace too. 
     91         * @return     string Namespaced class name. 
     92         *  
     93         */ 
     94        protected function getNamespacedClassName($clsName) 
     95        { 
     96                $newClassName = ''; 
     97                 
     98                // Hardest one to find is the OM so use it by default 
     99                $newClassName = $this->getNamespaceQualifier(self::NAMESPACE_OM) . $clsName; 
     100                 
     101                // Now adjust if needed. 
     102                if ($clsName == 'BasePeer') $newClassName = $this->getNamespaceQualifier(self::NAMESPACE_GLOBAL) . $clsName; 
     103                if (strstr($clsName,'Peer')) $newClassName = $this->getNamespaceQualifier(self::NAMESPACE_PEER) . $clsName; 
     104                if (strstr($clsName,'MapBuilder')) $newClassName = $this->getNamespaceQualifier(self::NAMESPACE_MAP) . $clsName; 
     105                 
     106                return $newClassName; 
     107        } 
     108         
    37109        /** 
    38110         * Builds the PHP source for current class and returns it as a string. 
     
    50122 
    51123                $script = "<" . "?php\n"; // intentional concatenation 
     124                $this->addNamespace($script); 
    52125                $this->addIncludes($script); 
    53126                $this->addClassOpen($script); 
     
    89162 
    90163        /** 
    91          * Returns the prefixed clasname that is being built by the current class. 
     164         * Returns the prefixed classname that is being built by the current class. 
     165         *  
     166         * @param $includeNamespace     boolean If true we will include the namespace prefix with the peer 
     167         * classname *if* namespace support was enabled in the properties file. 
    92168         * @return     string 
    93169         * @see        DataModelBuilder#prefixClassname() 
    94170         */ 
    95         public function getClassname() 
    96         { 
    97                 return $this->prefixClassname($this->getUnprefixedClassname()); 
    98         } 
     171        public function getClassname($includeNamespace = true) 
     172        { 
     173                if ($this->getBuildProperty('namespaceEnabled') <> 1 
     174                    OR !$includeNamespace) { 
     175                    return $this->prefixClassname($this->getUnprefixedClassname()); 
     176                } 
     177                return $this->getNamespacedClassName($this->prefixClassname($this->getUnprefixedClassname())); 
     178        } 
     179         
    99180        /** 
    100181         * Gets the dot-path representation of current class being built. 
     
    117198        public function getClassFilePath() 
    118199        { 
    119                 return ClassTools::getFilePath($this->getPackage(), $this->getClassname()); 
     200                return ClassTools::getFilePath($this->getPackage(), $this->getClassname(false)); 
    120201        } 
    121202 
     
    147228         * This is the classname that is used whenever object or peer classes want 
    148229         * to invoke methods of the peer classes. 
     230         * @param $includeNamespace     boolean If true we will include the namespace prefix with the peer 
     231         * classname *if* namespace support was enabled in the properties file. 
    149232         * @return     string (e.g. 'MyPeer') 
    150233         * @see        StubPeerBuilder::getClassname() 
    151234         */ 
    152         public function getPeerClassname() { 
    153                 return $this->getStubPeerBuilder()->getClassname(); 
     235        public function getPeerClassname($includeNamespace = true) { 
     236         
     237                if ($this->getBuildProperty('namespaceEnabled') <> 1 
     238                    OR !$includeNamespace) { 
     239                    return $this->getStubPeerBuilder()->getClassname(false); 
     240                } 
     241            return $this->getStubPeerBuilder()->getClassname(); 
    154242        } 
    155243 
     
    158246         * This is the classname that is used whenever object or peer classes want 
    159247         * to invoke methods of the object classes. 
     248         *  
     249         * @param $includeNamespace     boolean If true we will include the namespace prefix with the peer 
     250         * classname *if* namespace support was enabled in the properties file. 
    160251         * @return     string (e.g. 'My') 
    161252         * @see        StubPeerBuilder::getClassname() 
    162253         */ 
    163         public function getObjectClassname() { 
    164                 return $this->getStubObjectBuilder()->getClassname(); 
     254        public function getObjectClassname($includeNamespace = true) { 
     255                return $this->getStubObjectBuilder()->getClassname($includeNamespace); 
    165256        } 
    166257 
  • trunk/generator/classes/propel/engine/builder/om/ObjectBuilder.php

    r833 r1082  
    3535 */ 
    3636abstract class ObjectBuilder extends OMBuilder { 
    37  
    3837        /** 
    3938         * Constructs a new PeerBuilder subclass. 
  • trunk/generator/classes/propel/engine/builder/om/PeerBuilder.php

    r1068 r1082  
    3232 * 
    3333 * @author     Hans Lellelid <hans@xmpl.org> 
     34 * @author         Tony Bibbs <tony@tonybibbs.com> 
    3435 * @package    propel.engine.builder.om 
    3536 */ 
    3637abstract class PeerBuilder extends OMBuilder { 
    37  
    3838        protected $basePeerClass; 
    3939        protected $basePeerClassname; 
     
    5050                } 
    5151        } 
    52  
     52         
     53        /** 
     54         * Adds the namespace declaration if configured to do so.   
     55         * @param string &$script The script will be modified in this method. 
     56         */ 
     57        protected function addNamespace(&$script) 
     58        { 
     59                // If not enabled bail. 
     60                //print_r($this->getGeneratorConfig()); exit; 
     61                //print $this->getBuildProperty('namespaceEnabled'); die("\n\ndone\n\n"); 
     62                if ($this->getBuildProperty('namespaceEnabled') <> 1) return; 
     63                 
     64                $namespaceToUse = $this->getBuildProperty('namespacePeer'); 
     65                $script .= "\nnamespace $namespaceToUse;\n"; 
     66        } 
     67         
    5368        /** 
    5469         * Adds the addSelectColumns(), doCount(), etc. methods. 
  • trunk/generator/classes/propel/engine/builder/om/php5/PHP5ExtensionNodeBuilder.php

    r521 r1082  
    3333 * 
    3434 * @author     Hans Lellelid <hans@xmpl.org> 
     35 * @author     Tony Bibbs <tony@tonybibbs.com> 
    3536 * @package    propel.engine.builder.om.php5 
    3637 */ 
     
    9293 * @package    ".$this->getPackage()." 
    9394 */ 
    94 class ".$this->getClassname()." extends $baseClassname { 
     95class ".$this->getClassname(false)." extends $baseClassname { 
    9596"; 
    9697        } 
  • trunk/generator/classes/propel/engine/builder/om/php5/PHP5ExtensionNodePeerBuilder.php

    r521 r1082  
    3333 * 
    3434 * @author     Hans Lellelid <hans@xmpl.org> 
     35 * @author     Tony Bibbs <tony@tonybibbs.com 
    3536 * @package    propel.engine.builder.om.php5 
    3637 */ 
     
    9293 * @package    ".$this->getPackage()." 
    9394 */ 
    94 class ".$this->getClassname()." extends $baseClassname { 
     95class ".$this->getClassname(false)." extends $baseClassname { 
    9596"; 
    9697        } 
  • trunk/generator/classes/propel/engine/builder/om/php5/PHP5ExtensionObjectBuilder.php

    r1081 r1082  
    3333 * 
    3434 * @author     Hans Lellelid <hans@xmpl.org> 
     35 * @author     Tony Bibbs <tony@tonybibbs.com> 
    3536 * @package    propel.engine.builder.om.php5 
    3637 */ 
    3738class PHP5ExtensionObjectBuilder extends ObjectBuilder { 
    3839 
     40    /** 
     41         * Adds the namespace declaration if configured to do so.   
     42         * @param string &$script The script will be modified in this method. 
     43         */ 
     44        public function addNamespace(&$script)  
     45        { 
     46                // If not enabled bail. 
     47                if ($this->getBuildProperty('namespaceEnabled') <> 1) return; 
     48                 
     49                $namespaceToUse = $this->getBuildProperty('namespaceOm'); 
     50                $script .= "\nnamespace $namespaceToUse;\n";             
     51        } 
     52         
    3953        /** 
    4054         * Returns the name of the current class being built. 
     
    119133 * @package    ".$this->getPackage()." 
    120134 */ 
    121 ".($table->isAbstract() ? "abstract " : "")."class ".$this->getClassname()." extends $baseClassname { 
     135".($table->isAbstract() ? "abstract " : "")."class ".$this->getClassname(false)." extends $baseClassname { 
    122136"; 
    123137        } 
  • trunk/generator/classes/propel/engine/builder/om/php5/PHP5ExtensionPeerBuilder.php

    r521 r1082  
    3333 * 
    3434 * @author     Hans Lellelid <hans@xmpl.org> 
     35 * @author     Tony Bibbs <tony@tonybibbs.com> 
    3536 * @package    propel.engine.builder.om.php5 
    3637 */ 
     
    113114 * @package    ".$this->getPackage()." 
    114115 */ 
    115 class ".$this->getClassname()." extends $baseClassname { 
     116class ".$this->getClassname(false)." extends $baseClassname { 
    116117"; 
    117118        } 
  • trunk/generator/classes/propel/engine/builder/om/php5/PHP5InterfaceBuilder.php

    r521 r1082  
    3333 * 
    3434 * @author     Hans Lellelid <hans@xmpl.org> 
     35 * @author     Tony Bibbs <tony@tonybibbs.com> 
    3536 * @package    propel.engine.builder.om.php5 
    3637 */ 
     
    8990 * @package    ".$this->getPackage()." 
    9091 */ 
    91 interface ".$this->getClassname()." { 
     92interface ".$this->getClassname(false)." { 
    9293"; 
    9394        } 
  • trunk/generator/classes/propel/engine/builder/om/php5/PHP5MapBuilderBuilder.php

    r1068 r1082  
    3030 * 
    3131 * @author     Hans Lellelid <hans@xmpl.org> 
     32 * @author     Tony Bibbs <tony@tonybibbs.com> 
    3233 * @package    propel.engine.builder.om.php5 
    3334 */ 
    34 class PHP5MapBuilderBuilder extends OMBuilder { 
    35  
     35class PHP5MapBuilderBuilder extends OMBuilder {  
    3636        /** 
    3737         * Gets the package for the map builder classes. 
     
    4343        } 
    4444 
     45    /** 
     46         * Adds the namespace declaration if configured to do so.   
     47         * @param string &$script The script will be modified in this method. 
     48         */ 
     49        public function addNamespace(&$script)  
     50        { 
     51                // If not enabled bail. 
     52                if ($this->getBuildProperty('namespaceEnabled') <> 1) return; 
     53                 
     54                $namespaceToUse = $this->getBuildProperty('namespaceMap'); 
     55                $script .= "\nnamespace $namespaceToUse;\n";             
     56        } 
     57         
    4558        /** 
    4659         * Returns the name of the current class being built. 
     
    90103 * @package    ".$this->getPackage()." 
    91104 */ 
    92 class ".$this->getClassname()." implements MapBuilder { 
     105class ".$this->getClassname(false)." implements ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."MapBuilder { 
    93106"; 
    94107        } 
     
    203216         * 
    204217         * @return     void 
    205          * @throws     PropelException 
     218         * @throws     ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelException 
    206219         */ 
    207220        public function doBuild() 
    208221        { 
    209                 \$this->dbMap = Propel::getDatabaseMap(".$this->getPeerClassname()."::DATABASE_NAME); 
     222                \$this->dbMap = ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."Propel::getDatabaseMap(".$this->getPeerClassname()."::DATABASE_NAME); 
    210223 
    211224                \$tMap = \$this->dbMap->addTable(".$this->getPeerClassname()."::TABLE_NAME); 
  • trunk/generator/classes/propel/engine/builder/om/php5/PHP5MultiExtendObjectBuilder.php

    r1068 r1082  
    3333 * 
    3434 * @author     Hans Lellelid <hans@xmpl.org> 
     35 * @author     Tony Bibbs <tony@tonybibbs.com> 
    3536 * @package    propel.engine.builder.om.php5 
    3637 */ 
     
    121122        } // addIncludes() 
    122123 
     124        /** 
     125         * Adds the namespace declaration if configured to do so.   
     126         * @param string &$script The script will be modified in this method. 
     127         */ 
     128        protected function addNamespace(&$script) 
     129        { 
     130                if ($this->getBuildProperty('namespaceEnabled') <> 1) return; 
     131                 
     132                $namespaceToUse = $this->getBuildProperty('namespaceOm'); 
     133                $script .= "\nnamespace $namespaceToUse;\n"; 
     134        } 
     135         
    123136        /** 
    124137         * Adds class phpdoc comment and openning of class. 
     
    156169 * @package    ".$this->getPackage()." 
    157170 */ 
    158 class ".$this->getClassname()." extends ".$this->getParentClassname()." { 
     171class ".$this->getClassname(false)." extends ".$this->getParentClassname()." { 
    159172"; 
    160173        } 
  • trunk/generator/classes/propel/engine/builder/om/php5/PHP5NestedSetBuilder.php

    r1068 r1082  
    11<?php 
     2 
    23/* 
    34 *  $Id$ 
     
    2930 * 
    3031 * @author     Heltem <heltem@o2php.com> 
     32 * @author     Tony Bibbs <tony@tonybibbs.com> 
    3133 * @package    propel.engine.builder.om.php5 
    3234 */ 
     
    4244        } 
    4345 
     46        /** 
     47         * Adds the namespace declaration if configured to do so.   
     48         * @param string &$script The script will be modified in this method. 
     49         */ 
     50        protected function addNamespace(&$script) 
     51        { 
     52                // If not enabled bail. 
     53                if ($this->getBuildProperty('namespaceEnabled') <> 1) return; 
     54                 
     55                $namespaceToUse = $this->getBuildProperty('namespaceNest'); 
     56                $script .= "\nnamespace $namespaceToUse;\n"; 
     57        } 
     58                 
    4459        /** 
    4560         * Returns the name of the current class being built. 
     
    90105 * @package    ".$this->getPackage()." 
    91106 */ 
    92 abstract class ".$this->getClassname()." extends ".$this->getObjectBuilder()->getClassname()." implements NodeObject { 
     107abstract class ".$this->getClassname(false)." extends ".$this->getObjectBuilder()->getClassname()." implements ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."NodeObject { 
    93108"; 
    94109        } 
     
    259274         * If object is saved without left/right values, set them as undefined (0) 
    260275         * 
    261          * @param      PropelPDO Connection to use. 
     276         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO Connection to use. 
    262277         * @return     void 
    263          * @throws     PropelException 
    264          */ 
    265         public function save(PropelPDO \$con = null) 
     278         * @throws     ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelException 
     279         */ 
     280        public function save(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    266281        { 
    267282                \$left = \$this->getLeftValue(); 
     
    284299         * Removes this object and all descendants from datastore. 
    285300         * 
    286          * @param      PropelPDO Connection to use. 
     301         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO Connection to use. 
    287302         * @return     void 
    288          * @throws     PropelException 
    289          */ 
    290         public function delete(PropelPDO \$con = null) 
     303         * @throws     ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelException 
     304         */ 
     305        public function delete(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    291306        { 
    292307                // delete node first 
     
    308323         * 
    309324         * @return     $objectClassName The current object (for fluent API support) 
    310          * @throws     PropelException 
     325         * @throws     ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelException 
    311326         */ 
    312327        public function makeRoot() 
     
    325340         * Gets the level if set, otherwise calculates this and returns it 
    326341         * 
    327          * @param      PropelPDO Connection to use. 
     342         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO Connection to use. 
    328343         * @return     int 
    329344         */ 
    330         public function getLevel(PropelPDO \$con = null) 
     345        public function getLevel(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    331346        { 
    332347                if (null === \$this->level) { 
     
    385400         * @return     $objectClassName The current object (for fluent API support) 
    386401         */ 
    387         public function setParentNode(NodeObject \$parent = null) 
     402        public function setParentNode(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."NodeObject \$parent = null) 
    388403        { 
    389404                \$this->parentNode = (true === (\$this->hasParentNode = $peerClassname::isValid(\$parent))) ? \$parent : null; 
     
    404419         * @return     $objectClassName The current object (for fluent API support) 
    405420         */ 
    406         public function setPrevSibling(NodeObject \$node = null) 
     421        public function setPrevSibling(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."NodeObject \$node = null) 
    407422        { 
    408423                \$this->prevSibling = \$node; 
     
    424439         * @return     $objectClassName The current object (for fluent API support) 
    425440         */ 
    426         public function setNextSibling(NodeObject \$node = null) 
     441        public function setNextSibling(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."NodeObject \$node = null) 
    427442        { 
    428443                \$this->nextSibling = \$node; 
     
    440455         * Get the path to the node in the tree 
    441456         * 
    442          * @param      PropelPDO Connection to use. 
     457         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO Connection to use. 
    443458         * @return     array 
    444459         */ 
    445         public function getPath(PropelPDO \$con = null) 
     460        public function getPath(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    446461        { 
    447462                return $peerClassname::getPath(\$this, \$con); 
     
    457472         * Gets the number of children for the node (direct descendants) 
    458473         * 
    459          * @param      PropelPDO Connection to use. 
     474         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO Connection to use. 
    460475         * @return     int 
    461476         */ 
    462         public function getNumberOfChildren(PropelPDO \$con = null) 
     477        public function getNumberOfChildren(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    463478        { 
    464479                return $peerClassname::getNumberOfChildren(\$this, \$con); 
     
    474489         * Gets the total number of descendants for the node 
    475490         * 
    476          * @param      PropelPDO Connection to use. 
     491         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO Connection to use. 
    477492         * @return     int 
    478493         */ 
    479         public function getNumberOfDescendants(PropelPDO \$con = null) 
     494        public function getNumberOfDescendants(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    480495        { 
    481496                return $peerClassname::getNumberOfDescendants(\$this, \$con); 
     
    491506         * Gets the children for the node 
    492507         * 
    493          * @param      PropelPDO Connection to use. 
     508         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO Connection to use. 
    494509         * @return     array 
    495510         */ 
    496         public function getChildren(PropelPDO \$con = null) 
     511        public function getChildren(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    497512        { 
    498513                \$this->getLevel(); 
     
    514529         * Gets the descendants for the node 
    515530         * 
    516          * @param      PropelPDO Connection to use. 
     531         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO Connection to use. 
    517532         * @return     array 
    518533         */ 
    519         public function getDescendants(PropelPDO \$con = null) 
     534        public function getDescendants(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    520535        { 
    521536                \$this->getLevel(); 
     
    571586         * @return     bool 
    572587         */ 
    573         public function isEqualTo(NodeObject \$node) 
     588        public function isEqualTo(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."NodeObject \$node) 
    574589        { 
    575590                return $peerClassname::isEqualTo(\$this, \$node); 
     
    585600         * Tests if object has an ancestor 
    586601         * 
    587          * @param      PropelPDO \$con Connection to use. 
     602         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
    588603         * @return     bool 
    589604         */ 
    590         public function hasParent(PropelPDO \$con = null) 
     605        public function hasParent(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    591606        { 
    592607                if (null === \$this->hasParentNode) { 
     
    609624        public function hasChildren() 
    610625        { 
    611                 return $peerClassname::hasChildren(\$this); 
     626                return $peerClassname::hasChildren(\$this); 
    612627        } 
    613628"; 
     
    621636         * Determines if the node has previous sibling 
    622637         * 
    623          * @param      PropelPDO \$con Connection to use. 
     638         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
    624639         * @return     bool 
    625640         */ 
    626         public function hasPrevSibling(PropelPDO \$con = null) 
     641        public function hasPrevSibling(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    627642        { 
    628643                if (null === \$this->hasPrevSibling) { 
     
    641656         * Determines if the node has next sibling 
    642657         * 
    643          * @param      PropelPDO \$con Connection to use. 
     658         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
    644659         * @return     bool 
    645660         */ 
    646         public function hasNextSibling(PropelPDO \$con = null) 
     661        public function hasNextSibling(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    647662        { 
    648663                if (null === \$this->hasNextSibling) { 
     
    661676         * Gets ancestor for the given node if it exists 
    662677         * 
    663          * @param      PropelPDO \$con Connection to use. 
     678         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
    664679         * @return     mixed            Propel object if exists else false 
    665680         */ 
    666         public function retrieveParent(PropelPDO \$con = null) 
     681        public function retrieveParent(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    667682        { 
    668683                if (null === \$this->hasParentNode) { 
     
    682697         * Gets first child if it exists 
    683698         * 
    684          * @param      PropelPDO \$con Connection to use. 
     699         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
    685700         * @return     mixed            Propel object if exists else false 
    686701         */ 
    687         public function retrieveFirstChild(PropelPDO \$con = null) 
     702        public function retrieveFirstChild(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    688703        { 
    689704                if (\$this->hasChildren(\$con)) { 
     
    706721         * Gets last child if it exists 
    707722         * 
    708          * @param      PropelPDO \$con Connection to use. 
     723         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
    709724         * @return     mixed            Propel object if exists else false 
    710725         */ 
    711         public function retrieveLastChild(PropelPDO \$con = null) 
     726        public function retrieveLastChild(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    712727        { 
    713728                if (\$this->hasChildren(\$con)) { 
     
    730745         * Gets prev sibling for the given node if it exists 
    731746         * 
    732          * @param      PropelPDO \$con Connection to use. 
     747         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
    733748         * @return     mixed            Propel object if exists else false 
    734749         */ 
    735         public function retrievePrevSibling(PropelPDO \$con = null) 
     750        public function retrievePrevSibling(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    736751        { 
    737752                if (\$this->hasPrevSibling(\$con)) { 
     
    749764         * Gets next sibling for the given node if it exists 
    750765         * 
    751          * @param      PropelPDO \$con Connection to use. 
     766         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
    752767         * @return     mixed            Propel object if exists else false 
    753768         */ 
    754         public function retrieveNextSibling(PropelPDO \$con = null) 
     769        public function retrieveNextSibling(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
    755770        { 
    756771                if (\$this->hasNextSibling(\$con)) { 
     
    771786         * 
    772787         * @param      $objectClassName \$parent        Propel object for destination node 
    773          * @param      PropelPDO \$con Connection to use. 
    774          * @return     $objectClassName The current object (for fluent API support) 
    775          * @throws     PropelException - if this object already exists 
    776          */ 
    777         public function insertAsFirstChildOf(NodeObject \$parent, PropelPDO \$con = null) 
     788         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
     789         * @return     $objectClassName The current object (for fluent API support) 
     790         * @throws     ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelException - if this object already exists 
     791         */ 
     792        public function insertAsFirstChildOf(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."NodeObject \$parent, ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
     793        { 
     794                if (!\$this->isNew()) 
     795                { 
     796                        throw new ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelException(\"$objectClassName must be new.\"); 
     797                } 
     798                $peerClassname::insertAsFirstChildOf(\$this, \$parent, \$con); 
     799                return \$this; 
     800        } 
     801"; 
     802        } 
     803 
     804        protected function addInsertAsLastChildOf(&$script) 
     805        { 
     806                $objectClassName = $this->getStubObjectBuilder()->getClassname(); 
     807                $peerClassname = $this->getStubPeerBuilder()->getClassname(); 
     808                $script .= " 
     809        /** 
     810         * Inserts as last child of given destination node \$parent 
     811         * 
     812         * @param      $objectClassName \$parent        Propel object for destination node 
     813         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
     814         * @return     $objectClassName The current object (for fluent API support) 
     815         * @throws     ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelException - if this object already exists 
     816         */ 
     817        public function insertAsLastChildOf(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."NodeObject \$parent, ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con = null) 
     818        { 
     819                if (!\$this->isNew()) 
     820                { 
     821                        throw new ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelException(\"$objectClassName must be new.\"); 
     822                } 
     823                $peerClassname::insertAsLastChildOf(\$this, \$parent, \$con); 
     824                return \$this; 
     825        } 
     826"; 
     827        } 
     828 
     829        protected function addInsertAsPrevSiblingOf(&$script) 
     830        { 
     831                $objectClassName = $this->getStubObjectBuilder()->getClassname(); 
     832                $peerClassname = $this->getStubPeerBuilder()->getClassname(); 
     833                $script .= " 
     834        /** 
     835         * Inserts \$node as previous sibling to given destination node \$dest 
     836         * 
     837         * @param      $objectClassName \$dest  Propel object for destination node 
     838         * @param      ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelPDO \$con Connection to use. 
     839         * @return     $objectClassName The current object (for fluent API support) 
     840         * @throws     ".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."PropelException - if this object already exists 
     841         */ 
     842        public function insertAsPrevSiblingOf(".$this->getNamespaceQualifier(self::NAMESPACE_GLOBAL)."NodeObject \$dest, PropelPDO \$con = null) 
    778843        { 
    779844                if (!\$this->isNew()) 
     
    781846                        throw new PropelException(\"$objectClassName must be new.\"); 
    782847                } 
    783                 $peerClassname::insertAsFirstChildOf(\$this, \$parent, \$con); 
    784                 return \$this; 
    785         } 
    786 "; 
    787         } 
    788  
    789         protected function addInsertAsLastChildOf(&$script) 
    790         { 
    791                 $objectClassName = $this->getStubObjectBuilder()->getClassname(); 
    792                 $peerClassname = $this->getStubPeerBuilder()->getClassname(); 
    793                 $script .= " 
    794         /** 
    795          * Inserts as last child of given destination node \$paren
    796          * 
    797          * @param      $objectClassName \$parent      Propel object for destination node 
    798          * @param      PropelPDO \$con Connection to use. 
    799          * @return     $objectClassName The current object (for fluent API support) 
    800          * @throws     PropelException - if this object already exists 
    801          */ 
    802         public function insertAsLastChildOf(NodeObject \$parent, PropelPDO \$con = null) 
     848                $peerClassname::insertAsPrevSiblingOf(\$this, \$dest, \$con); 
     849                return \$this;