Changeset 6506
- Timestamp:
- 12/15/07 13:03:37 (1 year ago)
- Files:
-
- branches/dwhittle/UPGRADE (modified) (1 diff)
- branches/dwhittle/data/config/factories.yml (modified) (1 diff)
- branches/dwhittle/lib/command/sfCommandLogger.class.php (modified) (2 diffs)
- branches/dwhittle/lib/config/sfFactoryConfigHandler.class.php (modified) (1 diff)
- branches/dwhittle/lib/config/sfFilterConfigHandler.class.php (modified) (1 diff)
- branches/dwhittle/lib/controller/sfController.class.php (modified) (1 diff)
- branches/dwhittle/lib/database/sfDatabaseManager.class.php (modified) (1 diff)
- branches/dwhittle/lib/event/sfEvent.class.php (modified) (3 diffs)
- branches/dwhittle/lib/filter/sfFilterChain.class.php (modified) (1 diff)
- branches/dwhittle/lib/i18n/sfI18N.class.php (modified) (3 diffs)
- branches/dwhittle/lib/log/sfLogger.class.php (modified) (1 diff)
- branches/dwhittle/lib/plugin/sfSymfonyPluginManager.class.php (modified) (2 diffs)
- branches/dwhittle/lib/plugins/sfCompat10Plugin/config/config.php (modified) (1 diff)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/propel/sfPropel.class.php (modified) (1 diff)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml (modified) (1 diff)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/DataModelBuilder.php (modified) (2 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5NestedSetPeerBuilder.php (modified) (12 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ObjectBuilder.php (modified) (2 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/database/transform/XmlToData.php (modified) (5 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/platform/Platform.php (modified) (3 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/phing/PropelConvertConfTask.php (modified) (10 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/phing/PropelDataSQLTask.php (modified) (4 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/default.properties (modified) (1 diff)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/test/classes/bookstore/BookstoreDataPopulator.php (modified) (2 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/test/classes/propel/GeneratedNestedSetTest.php (modified) (4 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/test/classes/propel/GeneratedObjectRelTest.php (modified) (2 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/test/classes/propel/Ticket520Test.php (modified) (14 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/test/classes/propel/util/CriteriaTest.php (modified) (3 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel/Propel.php (modified) (6 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel/util/BasePeer.php (modified) (4 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel/util/PropelPDO.php (modified) (9 diffs)
- branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel/util/SlavePDO.php (modified) (4 diffs)
- branches/dwhittle/lib/response/sfWebResponse.class.php (modified) (1 diff)
- branches/dwhittle/lib/routing/sfRouting.class.php (modified) (2 diffs)
- branches/dwhittle/lib/storage/sfSessionStorage.class.php (modified) (2 diffs)
- branches/dwhittle/lib/util/sfContext.class.php (modified) (1 diff)
- branches/dwhittle/test/other/tasksTest.php (modified) (4 diffs)
- branches/dwhittle/test/unit/action/sfComponentTest.php (modified) (1 diff)
- branches/dwhittle/test/unit/config/fixtures/sfFilterConfigHandler/result.php (modified) (1 diff)
- branches/dwhittle/test/unit/event/sfEventDispatcherTest.php (modified) (1 diff)
- branches/dwhittle/test/unit/event/sfEventTest.php (copied) (copied from trunk/test/unit/event/sfEventTest.php)
- branches/dwhittle/test/unit/sfEventDispatcherTest.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/UPGRADE
r6419 r6506 281 281 now extend the `sfValidatorBase` class. 282 282 283 `->initialize()` methods 284 ------------------------ 285 286 Most symfony core classes are initialized thanks to a `->initialize()` method. As of symfony 1.1, 287 this method is automatically called by `__construct()`, so, there is no need to call it by yourself. 288 289 Configuration files loading 290 --------------------------- 291 292 Some core classes can be configured with a `.yml` file: 293 294 || '''Class''' || '''Configuration file''' || 295 || || || 296 || `sfAction` || `security.yml` || 297 || `sfAutoload` || `autoload.yml` || 298 || `sfConfigCache` || `config_handlers.yml` || 299 || `sfContext` || `factories.yml` || 300 || `sfController` || `generator.yml` and `module.yml` || 301 || `sfDatabaseManager` || `databases.yml` || 302 || `sfFilterChain` || `filters.yml` || 303 || `sfI18N` || `i18n.yml` || 304 || `sfPatternRouting` || `routing.yml` || 305 || `sfPHPView` || `view.yml` || 306 || `sfViewCacheManager` || `cache.yml` || 307 308 In symfony 1.1, the loading of the configuration file for ''independant'' sub-frameworks has been 309 moved to a `loadConfiguration()` method to ease decoupling and reuse them without needing the whole framework: 310 311 * `sfDatabaseManager` 312 * `sfI18N` 313 * `sfPatternRouting` 314 315 So, for example, if you need a database manager in your batch script, you will have to change from: 316 317 [php] 318 $databaseManager = new sfDatabaseManager(); 319 $databaseManager->initialize(); 320 321 to: 322 323 [php] 324 $databaseManager = new sfDatabaseManager(); 325 $databaseManager->loadConfiguration(); 326 327 The `initialize()` call is not needed anymore (see the point above). branches/dwhittle/data/config/factories.yml
r6419 r6506 28 28 class: sfI18N 29 29 param: 30 load_configuration: true 30 31 cache: 31 32 class: sfAPCCache branches/dwhittle/lib/command/sfCommandLogger.class.php
r5257 r6506 39 39 public function listenToLogEvent(sfEvent $event) 40 40 { 41 $priority = $event->getParameterHolder()->remove('priority', self::INFO);41 $priority = isset($event['priority']) ? $event['priority'] : self::INFO; 42 42 43 43 $prefix = ''; … … 50 50 } 51 51 52 foreach ($event->getParameter Holder()->getAll() as $message)52 foreach ($event->getParameters() as $message) 53 53 { 54 54 $this->log(sprintf('%s%s', $prefix, $message), $priority); branches/dwhittle/lib/config/sfFactoryConfigHandler.class.php
r4966 r6506 148 148 $cache = " \$cache = null;\n"; 149 149 } 150 151 $configuration = ''; 152 if (isset($parameters['load_configuration']) && $parameters['load_configuration']) 153 { 154 $configuration = " \$this->factories['i18n']->loadConfiguration();\n"; 155 } 150 156 $instances[] = sprintf("\n if (sfConfig::get('sf_i18n'))\n {\n". 151 157 " \$class = sfConfig::get('sf_factory_i18n', '%s');\n". 152 158 "%s". 153 159 " \$this->factories['i18n'] = new \$class(\$this, \$cache);\n". 160 $configuration. 154 161 " }\n" 155 162 , $class, $cache branches/dwhittle/lib/config/sfFilterConfigHandler.class.php
r4963 r6506 164 164 { 165 165 return sprintf("\nlist(\$class, \$parameters) = (array) sfConfig::get('sf_%s_filter', array('%s', %s));\n". 166 "\$filter = new \$class( \$this->context, \$parameters);\n".167 "\$ filterChain->register(\$filter);",166 "\$filter = new \$class(sfContext::getInstance(), \$parameters);\n". 167 "\$this->register(\$filter);", 168 168 $category, $class, $parameters); 169 169 } branches/dwhittle/lib/controller/sfController.class.php
r6262 r6506 247 247 // create a new filter chain 248 248 $filterChain = new sfFilterChain(); 249 250 require(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$moduleName.'/'.sfConfig::get('sf_app_module_config_dir_name').'/filters.yml')); 249 $filterChain->loadConfiguration($actionInstance); 251 250 252 251 $this->context->getEventDispatcher()->notify(new sfEvent($this, 'controller.change_action', array('module' => $moduleName, 'action' => $actionName))); branches/dwhittle/lib/database/sfDatabaseManager.class.php
r4963 r6506 50 50 public function initialize() 51 51 { 52 // load database configuration 52 $this->loadConfiguration(); 53 } 54 55 /** 56 * Loads database configuration. 57 */ 58 public function loadConfiguration() 59 { 53 60 require(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/databases.yml')); 54 61 } branches/dwhittle/lib/event/sfEvent.class.php
r5047 r6506 17 17 * @version SVN: $Id$ 18 18 */ 19 class sfEvent 19 class sfEvent implements ArrayAccess 20 20 { 21 21 protected 22 $value = null,23 $processed = false,24 $subject = null,25 $name = '',26 $parameter Holder= null;22 $value = null, 23 $processed = false, 24 $subject = null, 25 $name = '', 26 $parameters = null; 27 27 28 28 /** … … 38 38 $this->name = $name; 39 39 40 $this->parameterHolder = new sfParameterHolder(); 41 $this->parameterHolder->add($parameters); 40 $this->parameters = $parameters; 42 41 } 43 42 … … 102 101 } 103 102 104 public function getParameter Holder()103 public function getParameters() 105 104 { 106 return $this->parameter Holder;105 return $this->parameters; 107 106 } 108 107 109 public function getParameter($name, $default = null) 108 /** 109 * Returns true if the parameter exists (implements the ArrayAccess interface). 110 * 111 * @param string The parameter name 112 * 113 * @return Boolean true if the parameter exists, false otherwise 114 */ 115 public function offsetExists($name) 110 116 { 111 return $this->parameterHolder->get($name, $default);117 return isset($this->parameters[$name]); 112 118 } 113 119 114 public function hasParameter($name) 120 /** 121 * Returns a parameter value (implements the ArrayAccess interface). 122 * 123 * @param string The parameter name 124 * 125 * @return mixed The parameter value 126 */ 127 public function offsetGet($name) 115 128 { 116 return $this->parameterHolder->has($name);129 return isset($this->parameters[$name]) ? $this->parameters[$name] : null; 117 130 } 118 131 119 public function setParameter($name, $value) 132 /** 133 * Sets a parameter (implements the ArrayAccess interface). 134 * 135 * @param string The parameter name 136 * @param mixed 137 */ 138 public function offsetSet($name, $value) 120 139 { 121 return $this->parameterHolder->set($name, $value); 140 $this->parameters[$name] = $value; 141 } 142 143 /** 144 * Removes a parameter (implements the ArrayAccess interface). 145 * 146 * @param string The parameter name 147 */ 148 public function offsetUnset($name) 149 { 150 unset($this->parameters[$name]); 122 151 } 123 152 } branches/dwhittle/lib/filter/sfFilterChain.class.php
r4952 r6506 24 24 $chain = array(), 25 25 $index = -1; 26 27 /** 28 * Loads filters configuration for a given action instance. 29 * 30 * @param sfComponent A sfComponent instance 31 */ 32 public function loadConfiguration($actionInstance) 33 { 34 require(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$actionInstance->getModuleName().'/'.sfConfig::get('sf_app_module_config_dir_name').'/filters.yml')); 35 } 26 36 27 37 /** branches/dwhittle/lib/i18n/sfI18N.class.php
r4963 r6506 46 46 $this->cache = $cache; 47 47 48 include(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/i18n.yml'));49 50 48 $context->getEventDispatcher()->connect('user.change_culture', array($this, 'listenToChangeCultureEvent')); 51 49 $context->getEventDispatcher()->connect('controller.change_action', array($this, 'listenToChangeActionEvent')); 50 } 51 52 /** 53 * Loads i18n configuration. 54 */ 55 public function loadConfiguration() 56 { 57 include(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/i18n.yml')); 52 58 } 53 59 … … 266 272 { 267 273 // change the message format object with the new culture 268 $this->setCulture($event ->getParameter('culture'));274 $this->setCulture($event['culture']); 269 275 } 270 276 … … 278 284 { 279 285 // change message source directory to our module 280 $this->setMessageSource(sfLoader::getI18NDirs($event ->getParameter('module')));286 $this->setMessageSource(sfLoader::getI18NDirs($event['module'])); 281 287 } 282 288 } branches/dwhittle/lib/log/sfLogger.class.php
r5245 r6506 213 213 * 214 214 * @param sfEvent An sfEvent instance 215 *216 215 */ 217 216 public function listenToLogEvent(sfEvent $event) 218 217 { 219 $priority = $event->getParameterHolder()->remove('priority', self::INFO);218 $priority = isset($event['priority']) ? $event['priority'] : self::INFO; 220 219 $subject = $event->getSubject(); 221 220 $subject = is_object($subject) ? get_class($subject) : (is_string($subject) ? $subject : 'main'); 222 foreach ($event->getParameter Holder()->getAll() as $message)221 foreach ($event->getParameters() as $message) 223 222 { 224 223 $this->log(sprintf('{%s} %s', $subject, $message), $priority); branches/dwhittle/lib/plugin/sfSymfonyPluginManager.class.php
r5257 r6506 110 110 public function ListenToPluginPostInstall($event) 111 111 { 112 $this->installWebContent($event ->getParameter('plugin'));112 $this->installWebContent($event['plugin']); 113 113 } 114 114 … … 120 120 public function ListenToPluginPostUninstall($event) 121 121 { 122 $this->uninstallWebContent($event ->getParameter('plugin'));122 $this->uninstallWebContent($event['plugin']); 123 123 } 124 124 branches/dwhittle/lib/plugins/sfCompat10Plugin/config/config.php
r5386 r6506 1 1 <?php 2 2 3 class sfCompatAutoload extends sfSimpleAutoload 3 if (!class_exists('sfCompatAutoload', false)) 4 4 { 5 class sfCompatAutoload extends sfSimpleAutoload 6 { 7 } 8 9 if (sfConfig::get('sf_compat_10')) 10 { 11 // autoload classes 12 $autoload = sfCompatAutoload::getInstance(sfConfig::get('sf_app_cache_dir').'/sf_compat_autoloader.txt'); 13 $autoload->addDirectory(dirname(__FILE__).'/../lib'); 14 $autoload->register(); 15 16 // register config handler for validate/*.yml files 17 sfConfigCache::getInstance()->registerConfigHandler('modules/*/validate/*.yml', 'sfValidatorConfigHandler'); 18 19 // register the validation execution filter 20 sfConfig::set('sf_execution_filter', array('sfValidationExecutionFilter', array())); 21 } 5 22 } 6 7 if (sfConfig::get('sf_compat_10'))8 {9 // autoload classes10 $autoload = sfCompatAutoload::getInstance(sfConfig::get('sf_app_cache_dir').'/sf_compat_autoloader.txt');11 $autoload->addDirectory(dirname(__FILE__).'/../lib');12 $autoload->register();13 14 // register config handler for validate/*.yml files15 sfConfigCache::getInstance()->registerConfigHandler('modules/*/validate/*.yml', 'sfValidatorConfigHandler');16 17 // register the validation execution filter18 sfConfig::set('sf_execution_filter', array('sfValidationExecutionFilter', array()));19 }branches/dwhittle/lib/plugins/sfPropelPlugin/lib/propel/sfPropel.class.php
r5869 r6506 55 55 static public function listenToChangeCultureEvent(sfEvent $event) 56 56 { 57 self::setDefaultCulture($event ->getParameter('culture'));57 self::setDefaultCulture($event['culture']); 58 58 } 59 59 } branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml
r5248 r6506 476 476 xmlConfFile="${propel.conf.dir}/${propel.runtime.conf.file}" 477 477 outputDirectory="${propel.phpconf.dir}" 478 outputFile="${propel.runtime.phpconf.file}"> 478 outputFile="${propel.runtime.phpconf.file}" 479 outputClassmapFile="${propel.runtime.phpconf-classmap.file}"> 479 480 <schemafileset dir="${propel.schema.dir}" 480 481 includes="${propel.schema.sql.includes}" branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/DataModelBuilder.php
r6294 r6506 2 2 3 3 /* 4 * $Id: DataModelBuilder.php 8 44 2007-12-02 17:57:36Z hans$4 * $Id: DataModelBuilder.php 857 2007-12-13 14:59:59Z heltem $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 278 278 return $result; 279 279 } 280 280 281 281 /** 282 282 * A Name to use for the serials (dependant sequence in PostgreSQL) branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5NestedSetPeerBuilder.php
r6471 r6506 2 2 3 3 /* 4 * $Id: PHP5NestedSetPeerBuilder.php 8 54 2007-12-11 13:09:13Z heltem $4 * $Id: PHP5NestedSetPeerBuilder.php 865 2007-12-13 23:04:49Z heltem $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 171 171 172 172 $this->addShiftRParent($script); 173 $this->addupdateDBNode($script); 173 $this->addUpdateLoadedNode($script); 174 $this->addUpdateDBNode($script); 174 175 175 176 $this->addShiftRLValues($script); … … 311 312 self::shiftRLValues(\$child->getLeftValue(), 2, \$con, \$sidv); 312 313 313 // Update \$parent nodes properties recursively314 self:: shiftRParent(\$parent, 2, \$con);314 // Update all loaded nodes 315 self::updateLoadedNode(\$parent, 2, \$con); 315 316 } 316 317 "; … … 348 349 self::shiftRLValues(\$child->getLeftValue(), 2, \$con, \$sidv); 349 350 350 // Update \$parent nodes properties recursively351 self:: shiftRParent(\$parent, 2, \$con);351 // Update all loaded nodes 352 self::updateLoadedNode(\$parent, 2, \$con); 352 353 } 353 354 "; … … 385 386 self::shiftRLValues(\$node->getLeftValue(), 2, \$con, \$sidv); 386 387 387 // Update \$parent nodes properties recursively388 self:: shiftRParent(\$sibling->retrieveParent(), 2, \$con);388 // Update all loaded nodes 389 self::updateLoadedNode(\$sibling->retrieveParent(), 2, \$con); 389 390 } 390 391 "; … … 422 423 self::shiftRLValues(\$node->getLeftValue(), 2, \$con, \$sidv); 423 424 424 // Update \$parent nodes properties recursively425 self:: shiftRParent(\$sibling->retrieveParent(), 2, \$con);425 // Update all loaded nodes 426 self::updateLoadedNode(\$sibling->retrieveParent(), 2, \$con); 426 427 } 427 428 "; … … 464 465 \$node->save(\$con); 465 466 466 // Update \$parent nodes properties recursively467 self:: shiftRParent(\$previous_parent, 2, \$con);467 // Update all loaded nodes 468 self::updateLoadedNode(\$previous_parent, 2, \$con); 468 469 } 469 470 "; … … 1383 1384 } 1384 1385 1386 /** 1387 * TODO : Fix this broken in-memory nodes updater 1388 * Don't trust it 1389 */ 1385 1390 protected function addShiftRParent(&$script) 1386 1391 { … … 1408 1413 } 1409 1414 1410 protected function addupdateDBNode(&$script) 1411 { 1412 $objectClassname = $this->getStubObjectBuilder()->getClassname(); 1413 $script .= " 1414 /** 1415 * Move \$node and its children to location \$dest and updates rest of tree 1415 protected function addUpdateLoadedNode(&$script) 1416 { 1417 $objectClassname = $this->getStubObjectBuilder()->getClassname(); 1418 $peerClassname = $this->getStubPeerBuilder()->getClassname(); 1419 $table = $this->getTable(); 1420 1421 $script .= " 1422 /** 1423 * Reload all already loaded nodes to sync them with updated db 1424 * 1425 * @param $objectClassname \$node Propel object for parent node 1426 * @param int \$delta Value to be shifted by, can be negative 1427 * @param PropelPDO \$con Connection to use. 1428 */ 1429 protected static function updateLoadedNode(NodeObject \$node, \$delta, PropelPDO \$con = null) 1430 { 1431 if (Propel::isInstancePoolingEnabled()) 1432 { 1433 \$keys = array(); 1434 foreach(self::\$instances as \$obj) 1435 { 1436 \$keys[] = \$obj->getPrimaryKey(); 1437 } 1438 1439 if(!empty(\$keys)) 1440 { 1441 // We don't need to alter the object instance pool; we're just modifying this instance 1442 // already in the pool. 1443 1444 \$criteria = new Criteria(self::DATABASE_NAME); 1445 "; 1446 foreach ($table->getColumns() as $col) { 1447 if ($col->isPrimaryKey()) { 1448 $script .= " 1449 \$criteria->add(".$this->getColumnConstant($col).", \$keys, Criteria::IN); 1450 "; 1451 break; 1452 } /* if col is prim key */ 1453 } /* foreach */ 1454 $script .= " 1455 $peerClassname::populateObjects($peerClassname::doSelectStmt(\$criteria, \$con)); 1456 } 1457 } 1458 else 1459 { 1460 // FIX: Do a refresh for all in-memory nodes with a real tree traversal 1461 self::shiftRParent(\$node, \$delta, \$con); 1462 } 1463 } 1464 "; 1465 } 1466 1467 protected function addUpdateDBNode(&$script) 1468 { 1469 $objectClassname = $this->getStubObjectBuilder()->getClassname(); 1470 $script .= " 1471 /** 1472 * Move \$node and its children to location \$destLeft and updates rest of tree 1416 1473 * 1417 1474 * @param $objectClassname \$node Propel object for node to update 1475 * @param int \$destLeft Destination left value 1418 1476 * @param PropelPDO \$con Connection to use. 1419 * @param int Destination left value1420 1477 */ 1421 1478 protected static function updateDBNode(NodeObject \$node, \$destLeft, PropelPDO \$con = null) … … 1538 1595 // Shift left column values 1539 1596 \$whereCriteria = new Criteria(); 1540 \$criterion = \$whereCriteria->getNewCriterion( \$leftUpdateCol, \$first, Criteria::GREATER_EQUAL);1541 \$criterion->addAnd(\$whereCriteria->getNewCriterion( \$leftUpdateCol, \$last, Criteria::LESS_EQUAL));1597 \$criterion = \$whereCriteria->getNewCriterion(self::LEFT_COL, \$first, Criteria::GREATER_EQUAL); 1598 \$criterion->addAnd(\$whereCriteria->getNewCriterion(self::LEFT_COL, \$last, Criteria::LESS_EQUAL)); 1542 1599 if (self::SCOPE_COL) { 1543 1600 \$criterion->addAnd(\$whereCriteria->getNewCriterion(self::SCOPE_COL, \$scopeId, Criteria::EQUAL)); … … 1555 1612 // Shift right column values 1556 1613 \$whereCriteria = new Criteria(); 1557 \$criterion = \$whereCriteria->getNewCriterion( \$rightUpdateCol, \$first, Criteria::GREATER_EQUAL);1558 \$criterion->addAnd(\$whereCriteria->getNewCriterion( \$rightUpdateCol, \$last, Criteria::LESS_EQUAL));1614 \$criterion = \$whereCriteria->getNewCriterion(self::RIGHT_COL, \$first, Criteria::GREATER_EQUAL); 1615 \$criterion->addAnd(\$whereCriteria->getNewCriterion(self::RIGHT_COL, \$last, Criteria::LESS_EQUAL)); 1559 1616 if (self::SCOPE_COL) { 1560 1617 \$criterion->addAnd(\$whereCriteria->getNewCriterion(self::SCOPE_COL, \$scopeId, Criteria::EQUAL)); … … 1564 1621 \$valuesCriteria = new Criteria(); 1565 1622 \$valuesCriteria->add( 1566 self:: LEFT_COL,1623 self::RIGHT_COL, 1567 1624 array('raw' => \$rightUpdateCol . ' + ?', 'value' => \$delta), 1568 1625 Criteria::CUSTOM_EQUAL); branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ObjectBuilder.php
r6309 r6506 2 2 3 3 /* 4 * $Id: PHP5ObjectBuilder.php 8 48 2007-12-03 20:25:53Z hans$4 * $Id: PHP5ObjectBuilder.php 857 2007-12-13 14:59:59Z heltem $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 2226 2226 /** 2227 2227 * Clears out the $collName collection (array). 2228 * 2229 * This does not modify the database; however, it will remove any associated objects, causing 2228 * 2229 * This does not modify the database; however, it will remove any associated objects, causing 2230 2230 * them to be refetched by subsequent calls to accessor method. 2231 2231 * branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/database/transform/XmlToData.php
r5248 r6506 2 2 3 3 /* 4 * $Id: XmlToData.php 521 2007-01-05 13:29:36Z heltem$4 * $Id: XmlToData.php 861 2007-12-13 17:42:50Z gamr $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 32 32 * @author Martin Poeschl <mpoeschl@marmot.at> (Torque) 33 33 * @author Fedor Karpelevitch <fedor.karpelevitch@home.com> (Torque) 34 * @version $Revision: 521 $34 * @version $Revision: 861 $ 35 35 * @package propel.engine.database.transform 36 36 */ … … 41 41 42 42 private $encoding; 43 private $callback; 43 44 44 45 public $parser; … … 63 64 * 64 65 */ 65 public function parseFile($xmlFile )66 public function parseFile($xmlFile,$callback=null) 66 67 { 68 if ( $callback ) { 69 $this->callback = $callback; 70 } 67 71 try { 68 72 … … 113 117 $this->columnValues[] = new ColumnValue($col, iconv('utf-8',$this->encoding, $value)); 114 118 } 115 $this->data[] = new DataRow($table, $this->columnValues); 119 $data = new DataRow($table, $this->columnValues); 120 if ( $this->callback ) { 121 call_user_func($this->callback,$data); 122 $data = null; 123 } else { 124 $this->data[] = $data; 125 } 116 126 } 117 127 } catch (Exception $e) { branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/platform/Platform.php
r6294 r6506 1 1 <?php 2 2 /* 3 * $Id: Platform.php 8 44 2007-12-02 17:57:36Z hans$3 * $Id: Platform.php 857 2007-12-13 14:59:59Z heltem $ 4 4 * 5 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 25 25 * @author Hans Lellelid <hans@xmpl.org> (Propel) 26 26 * @author Martin Poeschl <mpoeschl@marmot.at> (Torque) 27 * @version $Revision: 8 44$27 * @version $Revision: 857 $ 28 28 * @package propel.engine.platform 29 29 */ … … 39 39 */ 40 40 const SEQUENCE = "sequence"; 41 41 42 42 /** 43 43 * Constant for serial id method (postgresql). 44 44 */ 45 45 const SERIAL = "serial"; 46 46 47 47 /** 48 48 * Sets a database connection to use (for quoting, etc.). branches/dwhittle/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/phing/PropelConvertConfTask.php
r6248 r6506 2 2 3 3 /* 4 * $Id: PropelConvertConfTask.php 8 32 2007-11-30 11:41:52Z hans $4 * $Id: PropelConvertConfTask.php 866 2007-12-14 19:13:24Z hans $ 5 5 * 6 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 40 40 41 41 /** 42 * @var PhingFileThis is the file where the converted conf array dump will be placed.42 * @var string This is the file where the converted conf array dump will be placed. 43 43 */ 44 44 private $outputFile; 45 46 /** 47 * @var string This is the file where the classmap manifest converted conf array dump will be placed. 48 */ 49 private $outputClassmapFile; 45 50 46 51 /** … … 66 71 67 72 /** 73 * [REQUIRED] Set the output filename for the autoload classmap. 74 * The directory is specified using AbstractPropelDataModelTask#setOutputDirectory(). 75 * @param string $outputFile 76 * @see AbstractPropelDataModelTask#setOutputDirectory() 77 */ 78 public function setOutputClassmapFile($outputFile) 79 { 80 // this is a string, not a file 81 $this->outputClassmapFile = $outputFile; 82 } 83 84 /** 68 85 * The main method does the work of the task. 69 86 */ … … 78 95 if (!$this->outputFile) { 79 96 throw new BuildException("No outputFile specified.", $this->getLocation()); 97 } 98 99 if (!$this->outputClassmapFile) { 100 // We'll create a default one for BC 101 $this->outputClassmapFile = 'classmap-' . $this->outputFile; 80 102 } 81 103 … … 87 109 88 110 $phpconf = self::simpleXmlToArray($xml); 89 111 $phpconfClassmap = array(); 112 90 113 // $this->log(var_export($phpconf,true)); 91 114 … … 99 122 100 123 $classMap = array(); 101 124 102 125 // $this->log("Processing class mappings in database: " . $database->getName()); 103 126 104 //print the tables127 //print the tables 105 128 foreach ($database->getTables() as $table) { 106 129 … … 162 185 } 163 186 164 $phpconf ['propel']['datasources'][$database->getName()]['classes'] = $classMap;165 } 166 } 167 168 // $phpconf['propel']['classes'] = $classMap;187 $phpconfClassmap['propel']['datasources'][$database->getName()]['classes'] = $classMap; 188 } 189 } 190 191 // $phpconf['propel']['classes'] = $classMap; 169 192 170 193 $phpconf['propel']['generator_version'] = DataModelBuilder::getBuildProperty('version'); … … 177 200 $output .= "// This file generated by Propel " . $phpconf['propel']['generator_version'] . " convert-props target".(DataModelBuilder::getBuildProperty('addTimestamp') ? " on " . strftime("%c") : '') . "\n"; 178 201 $output .= "// from XML runtime conf file " . $this->xmlConfFile->getPath() . "\n"; 179 $output .= "return "; 180 $output .= var_export($phpconf, true); 181 $output .= ";"; 182 183 $this->log("Creating PHP runtime conf file: " . $outfile->getPath()); 184 185 if (!file_put_contents($outfile->getAbsolutePath(), $output)) { 186 throw new BuildException("Error creating output file: " . $outfile->getAbsolutePath(), $this->getLocation()); 187 } 202 $output .= "return array_merge_recursive("; 203 $output .= var_export($phpconf, true); 204 $output .= ", include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '".$this->outputClassmapFile."'));"; 205 206 $this->log("Creating PHP runtime conf file: " . $outfile->getPath()); 207 if (!file_put_contents($outfile->getAbsolutePath(), $output)) { 208 throw new BuildException("Error creating output file: " . $outfile->getAbsolutePath(), $this->getLocation()); 209 } 210 211 $outfile = new PhingFile($this->outputDirectory, $this->outputClassmapFile); 212 $output = '<' . '?' . "php\n"; 213 $output .= "// This file generated by Propel " . $phpconf['propel']['generator_version'] . " convert-props target".(DataModelBuilder::getBuildProperty('addTimestamp') ? " on " . strftime("%c") : '') . "\n"; 214 $output .= "return "; 215 $output .= var_export($phpconfClassmap, true); 216 $output .= ";"; 217 $this->log("Creating PHP classmap runtime file: " . $outfile->getPath()); 218 if (!file_put_contents($outfile->getAbsolutePath(), $output)) { 219 throw new BuildException("Error creating output file: " . $outfile->getAbsolutePath(), $this->getLocation()); 220 } 221 188 222 189 223 } // main() … … 230 264 } 231 265 232 // if the $k is already in our children list, we need to transform233 // it into an array, else we add it as a value234 if ( !in_array( $k, array_keys($ar) ) ) {235 $ar[$k] = $child;236 } else {237 // if the $ar[$k] element is not already an array, then we need to make it one238 if ( !is_array( $ar[$k] ) ) { $ar[$k] = array( $ar[$k] ); }239 $ar[$k][] = $child;240 }266 // if the $k is already in our children list, we need to transform 267 // it into an array, else we add it as a value 268 if ( !in_array( $k, array_keys($ar) ) ) { 269 $ar[$k] = $child; 270 } else { 271 // if the $ar[$k] element is not already an array, then we need to make it one 272 if ( !is_array( $ar[$k] ) ) { $ar[$k] = array( $ar[$k] ); } 273 $ar[$k][] = $child; 274