Changeset 5561
- Timestamp:
- 10/17/07 12:00:38 (1 year ago)
- Files:
-
- plugins/sfPropelAlternativeSchemaPlugin/README (modified) (4 diffs)
- plugins/sfPropelAlternativeSchemaPlugin/lib/SfAlternativeObjectBuilder.php (added)
- plugins/sfPropelAlternativeSchemaPlugin/lib/SfAlternativePeerBuilder.php (added)
- plugins/sfPropelAlternativeSchemaPlugin/lib/sfPropelAlternativeSchema.class.php (deleted)
- plugins/sfPropelAlternativeSchemaPlugin/lib/sfPropelDatabaseSchema.class.php (modified) (2 diffs)
- plugins/sfPropelAlternativeSchemaPlugin/package.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelAlternativeSchemaPlugin/README
r5548 r5561 3 3 == Overview == 4 4 5 This plugin extends the symfony model generator, based on Propel, to allow a schema to override another one. It also provides a new YAML syntax for defining database schemas, more explicit and more readable. This new syntax is completely backward compatible with symfony's current `schema.yml` syntax, so installing this plugin will not break your applications. 5 This plugin extends the symfony model generator, based on Propel, to allow a schema to override another one. It also provides a new YAML syntax for defining database schemas, more explicit and more readable. This new syntax is completely backward compatible with symfony's current `schema.yml` syntax, so installing this plugin will not break your applications. Additionally, the new syntax adds a few new features to schemas, such as the ability to define a behavior from a schema. 6 6 7 7 == Installation == … … 154 154 == Behaviors == 155 155 156 The new schema syntax alows you to define behaviors directly from the schema itself. To allow the support for these schema behaviors, you must add this line at the end of all your application's `config.php`: 157 158 {{{ 159 // In apps/myapp/config/config.php 160 sfPropelAlternativeSchema::initializeBehaviors(); 156 The new schema syntax alows you to define behaviors directly from the schema itself. To allow the support for these schema behaviors, you must change two lines in the 'Builder Settings' section of your project's `propel.ini`: 157 158 {{{ 159 // In config/propel.ini 160 ; builder settings 161 propel.builder.peer.class = plugins.sfPropelAlternativeSchemaPlugin.lib.SfAlternativePeerBuilder 162 propel.builder.object.class = plugins.sfPropelAlternativeSchemaPlugin.lib.SfAlternativeObjectBuilder 161 163 }}} 162 164 … … 172 174 Of course, don't forget to rebuild the model after you modify your schema. 173 175 174 This feature groups the behaviors declarations into a single file called `behaviors.php`, located under the `cache/` directory, for maximum efficiency. This file will be regenerated during the first request after each model rebuild. 175 176 Note that this feature will also add `.behaviors` files under your project's `config/` directory. These are generated by the `propel-build-model` task and should not be deleted, otherwise the behaviors will not work when you transfer the project to another host and clear the cache manually. 176 Note: Incidentally, behaviors entered this way are registered both in the model and peer classes, which seems to solve some problems with behaviors (like #1229). 177 177 178 178 == Customizing an existing schema == … … 293 293 === Trunk === 294 294 295 * francois: Added a fix for the too late initialization of behaviors in symfony when adding hooks to custom class 295 296 * francois: Added a way to define behaviors from the schema 296 297 * francois: Added a new `foreignClass` column attribute to define a foreign key from a phpName rather than from a tableName plugins/sfPropelAlternativeSchemaPlugin/lib/sfPropelDatabaseSchema.class.php
r5548 r5561 91 91 public function loadNewYaml($schema) 92 92 { 93 sfPropelAlternativeSchema::cleanBehaviorsOnce();94 93 95 94 if(isset($schema['connection'])) … … 137 136 } 138 137 138 // Table attributes 139 $tableAttributes = array(); 140 139 141 // Behaviors 140 142 if(isset($classParams['behaviors'])) 141 143 { 142 sfPropelAlternativeSchema::addBehaviors($className,$classParams['behaviors']);144 $tableAttributes['behaviors'] = serialize($classParams['behaviors']); 143 145 unset($classParams['behaviors']); 144 } 146 } 145 147 146 // Table attributes147 $tableAttributes = array();148 148 if(isset($classParams['tableName'])) 149 149 { plugins/sfPropelAlternativeSchemaPlugin/package.xml
r5548 r5561 32 32 <dir name="lib"> 33 33 <file role="data" name="sfPropelDatabaseSchema.class.php" /> 34 <file role="data" name="sfPropelAlternativeSchema.class.php" /> 34 <file role="data" name="SfAlternativeObjectBuilder.php" /> 35 <file role="data" name="SfAlternativePeerBuilder.php" /> 35 36 </dir> 36 37