Changeset 5578
- Timestamp:
- 10/18/07 09:54:16 (6 years ago)
- Files:
-
- plugins/sfPropelAlternativeSchemaPlugin/README (modified) (2 diffs)
- plugins/sfPropelAlternativeSchemaPlugin/lib/sfPropelDatabaseSchema.class.php (modified) (3 diffs)
- plugins/sfPropelAlternativeSchemaPlugin/package.xml (modified) (1 diff)
- plugins/sfPropelAlternativeSchemaPlugin/test/unit/fixtures/new_schema.yml (modified) (1 diff)
- plugins/sfPropelAlternativeSchemaPlugin/test/unit/fixtures/schema.xml (modified) (1 diff)
- plugins/sfPropelAlternativeSchemaPlugin/test/unit/fixtures/schema.yml (modified) (1 diff)
- plugins/sfPropelAlternativeSchemaPlugin/test/unit/sfPropelDatabaseSchemaTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelAlternativeSchemaPlugin/README
r5564 r5578 259 259 classes: 260 260 Article: 261 columns: 262 title: varchar(50) 261 263 behaviors: 262 paranoid: { column: deleted_at }264 paranoid: { column: deleted_at } 263 265 }}} 264 266 265 267 Of course, don't forget to rebuild the model after you modify your schema. 268 269 It is also possible to define behaviors in the current syntax if you enabled the custom builder in the `propel.ini`. Just add a leading underscore before the `behaviors` key and define behaviors the same a above: 270 271 {{{ 272 propel: 273 ij_article: 274 _attributes: { phpName: Article } 275 title: varchar(50) 276 _behaviors: 277 paranoid: { column: deleted_at } 278 }}} 279 266 280 267 281 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). … … 379 393 === Trunk === 380 394 395 * francois: Added support for behaviors in the old syntax, too 381 396 * francois: Added new/old YAML syntax conversion. It is now possible to customize an old schema even if it doesn't use the alternative syntax. 382 397 * francois: Added a fix for the too late initialization of behaviors in symfony when adding hooks to custom class plugins/sfPropelAlternativeSchemaPlugin/lib/sfPropelDatabaseSchema.class.php
r5565 r5578 142 142 switch($column) 143 143 { 144 case '_behaviors': 145 $classes[$phpName]['behaviors'] = $column_params; 146 break; 144 147 case '_foreignKeys': 145 148 $classes[$phpName]['foreignKeys'] = $column_params; … … 210 213 } 211 214 215 // Behaviors 216 if(isset($classParams['behaviors'])) 217 { 218 $tableParams['_behaviors'] = $classParams['behaviors']; 219 unset($classParams['behaviors']); 220 } 221 212 222 // Table attributes 213 223 $tableAttributes = array(); 214 215 // Behaviors216 if(isset($classParams['behaviors']))217 {218 $tableAttributes['behaviors'] = serialize($classParams['behaviors']);219 unset($classParams['behaviors']);220 }221 222 224 if(isset($classParams['tableName'])) 223 225 { … … 264 266 foreach ($this->getChildren($this->database) as $tb_name => $table) 265 267 { 266 $xml .= "\n <table name=\"$tb_name\"".$this->getAttributesFor($table).">\n"; 268 $xml .= "\n <table name=\"$tb_name\"".$this->getAttributesFor($table); 269 if (isset($table['_behaviors'])) 270 { 271 $xml .= sprintf(" behaviors=\"%s\"", htmlspecialchars(serialize($table['_behaviors']))); 272 } 273 $xml .= ">\n"; 267 274 268 275 // columns plugins/sfPropelAlternativeSchemaPlugin/package.xml
r5561 r5578 14 14 <active>yes</active> 15 15 </lead> 16 <date>2007-10- 05</date>16 <date>2007-10-18</date> 17 17 <version> 18 <release> 0.9.0</release>19 <api> 0.9.0</api>18 <release>1.0.0</release> 19 <api>1.0.0</api> 20 20 </version> 21 21 <stability> 22 <release> beta</release>23 <api> beta</api>22 <release>stable</release> 23 <api>stable</api> 24 24 </stability> 25 25 <license uri="http://www.symfony-project.com/license">MIT license</license> plugins/sfPropelAlternativeSchemaPlugin/test/unit/fixtures/new_schema.yml
r5565 r5578 55 55 uniques: 56 56 my_other_index: [created_at] 57 behaviors: 58 paranoid: { column: deleted_at } 59 act_as_nested_set: 60 57 61 58 62 AbGroupI18n: plugins/sfPropelAlternativeSchemaPlugin/test/unit/fixtures/schema.xml
r5519 r5578 54 54 </table> 55 55 56 <table name="ij_article" phpName="Article" >56 <table name="ij_article" phpName="Article" behaviors="a:2:{s:8:"paranoid";a:1:{s:6:"column";s:10:"deleted_at";}s:17:"act_as_nested_set";N;}"> 57 57 <column name="title" type="varchar" size="50" /> 58 58 <column name="user_id" type="integer" /> plugins/sfPropelAlternativeSchemaPlugin/test/unit/fixtures/schema.yml
r5519 r5578 41 41 _uniques: 42 42 my_other_index: [created_at] 43 _behaviors: 44 paranoid: { column: deleted_at } 45 act_as_nested_set: 43 46 44 47 ab_group_i18n: plugins/sfPropelAlternativeSchemaPlugin/test/unit/sfPropelDatabaseSchemaTest.php
r5565 r5578 49 49 } 50 50 51 $t = new my_lime_test(2 57, new lime_output_color());51 $t = new my_lime_test(261, new lime_output_color()); 52 52 53 53 require_once(dirname(__FILE__).'/../../lib/sfPropelDatabaseSchema.class.php');