Ignore:
Timestamp:
11.07.2006 21:00:11 (4 years ago)
Author:
hans
Message:

ticket:268 (wrapping up)

  • Reverted the change from changeset:372 that required that static code be put in the extension classes
  • Changed static attributes of the base peer class to not reference the peer subclass
  • Changed OMBuilder::getColumnConstant() method to take an optional classname parameter.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/generator/classes/propel/engine/builder/om/php5/PHP5BasicPeerBuilder.php

    r417 r423  
    118118} // " . $this->getClassname() . " 
    119119"; 
    120         } 
     120                $this->addStaticMapBuilderRegistration($script); 
     121        } 
     122 
     123        /** 
     124         * Adds the static map builder registration code. 
     125         * @param string &$script The script will be modified in this method. 
     126         */ 
     127        protected function addStaticMapBuilderRegistration(&$script) 
     128        { 
     129                $table = $this->getTable(); 
     130                $mapBuilderFile = $this->getMapBuilderBuilder()->getClassFilePath(); 
     131 
     132                $script .= " 
     133// This is the static code needed to register the MapBuilder for this table with the main Propel class. 
     134// 
     135// NOTE: This static code cannot call methods on the ".$this->getPeerClassname()." class, because it is not defined yet. 
     136// If you need to use overridden methods, you can add this code to the bottom of the ".$this->getPeerClassname()." class: 
     137//  
     138// Propel::getDatabaseMap(".$this->getPeerClassname()."::DATABASE_NAME)->addTableBuilder(".$this->getPeerClassname()."::TABLE_NAME, ".$this->getPeerClassname()."::getMapBuilder()); 
     139//  
     140// Doing so will effectively overwrite the registration below. 
     141 
     142Propel::getDatabaseMap(".$this->getClassname()."::DATABASE_NAME)->addTableBuilder(".$this->getClassname()."::TABLE_NAME, ".$this->getClassname()."::getMapBuilder()); 
     143 
     144"; 
     145        } 
     146 
    121147 
    122148        /** 
     
    208234                BasePeer::TYPE_COLNAME => array ("; 
    209235                foreach ($tableColumns as $col) { 
    210                         $script .= $this->getColumnConstant($col).", "; 
     236                        $script .= $this->getColumnConstant($col, 'self').", "; 
    211237                } 
    212238                $script .= "), 
     
    247273                BasePeer::TYPE_COLNAME => array ("; 
    248274                foreach ($tableColumns as $num => $col) { 
    249                         $script .= $this->getColumnConstant($col)." => $num, "; 
     275                        $script .= $this->getColumnConstant($col, 'self')." => $num, "; 
    250276                } 
    251277                $script .= "), 
Note: See TracChangeset for help on using the changeset viewer.