Changeset 7131
- Timestamp:
- 01/21/08 15:48:28 (1 year ago)
- Files:
-
- trunk/LICENSE (modified) (1 diff)
- trunk/UPGRADE (modified) (1 diff)
- trunk/data/bin/check_configuration.php (copied) (copied from branches/1.1/data/bin/check_configuration.php)
- trunk/data/bin/symfony.bat (modified) (1 diff)
- trunk/data/config/config_handlers.yml (modified) (3 diffs)
- trunk/data/config/php.yml (deleted)
- trunk/data/skeleton/batch (deleted)
- trunk/data/skeleton/module/test/actionsTest.php (modified) (1 diff)
- trunk/data/skeleton/plugin (deleted)
- trunk/data/skeleton/project/data/model (deleted)
- trunk/data/skeleton/project/web/.htaccess (modified) (1 diff)
- trunk/lib/action/sfComponent.class.php (modified) (1 diff)
- trunk/lib/config/sfDatabaseConfigHandler.class.php (modified) (4 diffs)
- trunk/lib/config/sfLoader.class.php (modified) (1 diff)
- trunk/lib/config/sfPhpConfigHandler.class.php (deleted)
- trunk/lib/controller/sfController.class.php (modified) (1 diff)
- trunk/lib/exception/sfError404Exception.class.php (modified) (2 diffs)
- trunk/lib/filter/sfBasicSecurityFilter.class.php (modified) (2 diffs)
- trunk/lib/form/sfForm.class.php (modified) (15 diffs)
- trunk/lib/form/sfFormField.class.php (modified) (8 diffs)
- trunk/lib/form/sfFormFieldSchema.class.php (copied) (copied from branches/1.1/lib/form/sfFormFieldSchema.class.php)
- trunk/lib/generator/sfAdminGenerator.class.php (modified) (1 diff)
- trunk/lib/generator/sfCrudGenerator.class.php (modified) (1 diff)
- trunk/lib/i18n/sfChoiceFormat.class.php (modified) (1 diff)
- trunk/lib/i18n/sfCultureInfo.class.php (modified) (1 diff)
- trunk/lib/i18n/sfDateFormat.class.php (modified) (1 diff)
- trunk/lib/i18n/sfDateTimeFormatInfo.class.php (modified) (1 diff)
- trunk/lib/i18n/sfIMessageSource.class.php (modified) (1 diff)
- trunk/lib/i18n/sfMessageFormat.class.php (modified) (1 diff)
- trunk/lib/i18n/sfMessageSource.class.php (modified) (1 diff)
- trunk/lib/i18n/sfMessageSource_Database.class.php (modified) (1 diff)
- trunk/lib/i18n/sfMessageSource_File.class.php (modified) (1 diff)
- trunk/lib/i18n/sfMessageSource_MySQL.class.php (modified) (1 diff)
- trunk/lib/i18n/sfMessageSource_SQLite.class.php (modified) (1 diff)
- trunk/lib/i18n/sfMessageSource_XLIFF.class.php (modified) (1 diff)
- trunk/lib/i18n/sfMessageSource_gettext.class.php (modified) (1 diff)
- trunk/lib/i18n/sfNumberFormat.class.php (modified) (1 diff)
- trunk/lib/i18n/sfNumberFormatInfo.class.php (modified) (1 diff)
- trunk/lib/log/sfWebDebugLogger.class.php (modified) (4 diffs)
- trunk/lib/plugins/sfCompat10Plugin/config/config_handlers.yml (copied) (copied from branches/1.1/lib/plugins/sfCompat10Plugin/config/config_handlers.yml)
- trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelAdmin/default/template/actions/actions.class.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/skeleton/config/generator.yml (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/actions/actions.class.php (modified) (2 diffs)
- trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/templates/editSuccess.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/templates/indexSuccess.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/templates/indexSuccess.php)
- trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/templates/listSuccess.php (deleted)
- trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/templates/showSuccess.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelForm/default/template/sfPropelFormGeneratedTemplate.php (modified) (3 diffs)
- trunk/lib/plugins/sfPropelPlugin/lib/creole/drivers/sfDebugConnection.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfExtensionObjectBuilder.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfExtensionPeerBuilder.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfMapBuilderBuilder.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfMultiExtendObjectBuilder.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfObjectBuilder.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/database/sfPropelDatabase.class.php (modified) (2 diffs)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php (modified) (5 diffs)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/sfFormPropel.class.php (modified) (2 diffs)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelAutoload.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelBehavior.class.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelData.class.php (modified) (13 diffs)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelDatabaseSchema.class.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelManyToMany.class.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelPager.class.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/task/sfPropelBaseTask.class.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/lib/task/sfPropelGenerateCrudTask.class.php (modified) (5 diffs)
- trunk/lib/plugins/sfPropelPlugin/lib/task/sfPropelInitCrudTask.class.php (deleted)
- trunk/lib/plugins/sfPropelPlugin/test/functional/browseTest.php (modified) (4 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crud1Test.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crud1Test.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crud2Test.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crud2Test.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crud3Test.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crud3Test.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crud4Test.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crud4Test.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crud5Test.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crud5Test.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crud6Test.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crud6Test.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crud7Test.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crud7Test.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crud8Test.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crud8Test.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crud9Test.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crud9Test.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crud/crudBrowser.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/crud/crudBrowser.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/crudTest.php (deleted)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/apps/crud/modules/simple (deleted)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/config/schema.xml (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/config/schema.yml (deleted)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/ArticleForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/ArticleForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/AuthorArticleForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/AuthorArticleForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/AuthorForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/AuthorForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/BaseFormPropel.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/BaseFormPropel.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/BookForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/BookForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/CategoryForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/CategoryForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseArticleForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseArticleForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorArticleForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorArticleForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseAuthorForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseBookForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseBookForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseCategoryForm.class.php (copied) (copied from branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/base/BaseCategoryForm.class.php)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/Book.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/Category.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/map/ArticleMapBuilder.php (modified) (1 diff)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseArticle.php (modified) (5 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseArticlePeer.php (modified) (2 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthor.php (modified) (3 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthorArticle.php (modified) (2 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthorArticlePeer.php (modified) (2 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthorPeer.php (modified) (2 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseBook.php (modified) (3 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseBookPeer.php (modified) (2 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseCategory.php (modified) (3 diffs)
- trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseCategoryPeer.php (modified) (2 diffs)
- trunk/lib/request/sfWebRequest.class.php (modified) (3 diffs)
- trunk/lib/response/sfWebResponse.class.php (modified) (1 diff)
- trunk/lib/routing/sfNoRouting.class.php (modified) (2 diffs)
- trunk/lib/routing/sfPathInfoRouting.class.php (modified) (1 diff)
- trunk/lib/routing/sfPatternRouting.class.php (modified) (1 diff)
- trunk/lib/task/cache/sfCacheClearTask.class.php (modified) (1 diff)
- trunk/lib/task/configure (copied) (copied from branches/1.1/lib/task/configure)
- trunk/lib/task/configure/sfConfigureAuthorTask.class.php (copied) (copied from branches/1.1/lib/task/configure/sfConfigureAuthorTask.class.php)
- trunk/lib/task/configure/sfConfigureDatabaseTask.class.php (copied) (copied from branches/1.1/lib/task/configure/sfConfigureDatabaseTask.class.php)
- trunk/lib/task/generator/sfGenerateAppTask.class.php (modified) (1 diff)
- trunk/lib/task/generator/sfGenerateBatchTask.class.php (deleted)
- trunk/lib/task/generator/sfGenerateControllerTask.class.php (modified) (1 diff)
- trunk/lib/task/generator/sfGenerateModuleTask.class.php (modified) (1 diff)
- trunk/lib/task/generator/sfGeneratePluginTask.class.php (deleted)
- trunk/lib/task/generator/sfGenerateProjectTask.class.php (modified) (1 diff)
- trunk/lib/task/generator/sfGeneratorBaseTask.class.php (modified) (1 diff)
- trunk/lib/task/help/sfCommandApplicationTask.class.php (modified) (1 diff)
- trunk/lib/task/help/sfHelpTask.class.php (modified) (1 diff)
- trunk/lib/task/help/sfListTask.class.php (modified) (1 diff)
- trunk/lib/task/i18n/sfI18nExtractTask.class.php (modified) (1 diff)
- trunk/lib/task/i18n/sfI18nFindTask.class.php (modified) (1 diff)
- trunk/lib/task/log/sfLogClearTask.class.php (modified) (1 diff)
- trunk/lib/task/log/sfLogRotateTask.class.php (modified) (1 diff)
- trunk/lib/task/plugin/sfPluginAddChannelTask.class.php (modified) (1 diff)
- trunk/lib/task/plugin/sfPluginBaseTask.class.php (modified) (1 diff)
- trunk/lib/task/plugin/sfPluginInstallTask.class.php (modified) (1 diff)
- trunk/lib/task/plugin/sfPluginListTask.class.php (modified) (1 diff)
- trunk/lib/task/plugin/sfPluginUninstallTask.class.php (modified) (1 diff)
- trunk/lib/task/plugin/sfPluginUpgradeTask.class.php (modified) (1 diff)
- trunk/lib/task/project/sfProjectClearControllersTask.class.php (modified) (1 diff)
- trunk/lib/task/project/sfProjectDeployTask.class.php (modified) (1 diff)
- trunk/lib/task/project/sfProjectDisableTask.class.php (modified) (1 diff)
- trunk/lib/task/project/sfProjectEnableTask.class.php (modified) (1 diff)
- trunk/lib/task/project/sfProjectFreezeTask.class.php (modified) (1 diff)
- trunk/lib/task/project/sfProjectPermissionsTask.class.php (modified) (1 diff)
- trunk/lib/task/project/sfProjectUnfreezeTask.class.php (modified) (1 diff)
- trunk/lib/task/project/sfUpgradeTo11Task.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfAutoloadingUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfComponentUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfEnvironmentUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfFactoriesUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfFlashUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfLoggerUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfPropelUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfSingletonUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/project/upgrade1.1/sfWebDebugUpgrade.class.php (modified) (1 diff)
- trunk/lib/task/sfBaseTask.class.php (modified) (2 diffs)
- trunk/lib/task/sfTask.class.php (modified) (2 diffs)
- trunk/lib/task/test/sfTestAllTask.class.php (modified) (1 diff)
- trunk/lib/task/test/sfTestFunctionalTask.class.php (modified) (1 diff)
- trunk/lib/task/test/sfTestUnitTask.class.php (modified) (1 diff)
- trunk/lib/user/sfUser.class.php (modified) (1 diff)
- trunk/lib/util/sfAutoload.class.php (modified) (8 diffs)
- trunk/lib/util/sfBrowser.class.php (modified) (26 diffs)
- trunk/lib/util/sfCallable.class.php (modified) (2 diffs)
- trunk/lib/util/sfContext.class.php (modified) (9 diffs)
- trunk/lib/util/sfCore.class.php (modified) (9 diffs)
- trunk/lib/util/sfFinder.class.php (modified) (2 diffs)
- trunk/lib/util/sfInflector.class.php (modified) (1 diff)
- trunk/lib/util/sfSimpleAutoload.class.php (modified) (1 diff)
- trunk/lib/util/sfToolkit.class.php (modified) (8 diffs)
- trunk/lib/util/sfYaml.class.php (modified) (4 diffs)
- trunk/lib/util/sfYamlInline.class.php (modified) (9 diffs)
- trunk/lib/validator/sfValidator.class.php (modified) (1 diff)
- trunk/lib/validator/sfValidatorAll.class.php (deleted)
- trunk/lib/validator/sfValidatorAnd.class.php (copied) (copied from branches/1.1/lib/validator/sfValidatorAnd.class.php)
- trunk/lib/validator/sfValidatorAny.class.php (deleted)
- trunk/lib/validator/sfValidatorCallback.class.php (modified) (3 diffs)
- trunk/lib/validator/sfValidatorDate.class.php (modified) (3 diffs)
- trunk/lib/validator/sfValidatorErrorSchema.class.php (modified) (5 diffs)
- trunk/lib/validator/sfValidatorFile.class.php (modified) (2 diffs)
- trunk/lib/validator/sfValidatorFromDescription.class.php (modified) (1 diff)
- trunk/lib/validator/sfValidatorOr.class.php (copied) (copied from branches/1.1/lib/validator/sfValidatorOr.class.php)
- trunk/lib/validator/sfValidatorSchema.class.php (modified) (10 diffs)
- trunk/lib/validator/sfValidatorSchemaCompare.class.php (modified) (3 diffs)
- trunk/lib/validator/sfValidatorSchemaForEach.class.php (modified) (2 diffs)
- trunk/lib/validator/sfValidatorUrl.class.php (modified) (1 diff)
- trunk/lib/view/escaper/sfOutputEscaper.class.php (modified) (6 diffs)
- trunk/lib/view/escaper/sfOutputEscaperSafe.class.php (copied) (copied from branches/1.1/lib/view/escaper/sfOutputEscaperSafe.class.php)
- trunk/lib/view/sfEscapedViewParameterHolder.class.php (modified) (5 diffs)
- trunk/lib/view/sfView.class.php (modified) (1 diff)
- trunk/lib/widget/sfWidgetFormDate.class.php (modified) (2 diffs)
- trunk/lib/widget/sfWidgetFormSchema.class.php (modified) (7 diffs)
- trunk/lib/widget/sfWidgetFormSchemaDecorator.class.php (modified) (5 diffs)
- trunk/lib/widget/sfWidgetFormSchemaForEach.class.php (modified) (3 diffs)
- trunk/lib/widget/sfWidgetFormTime.class.php (modified) (3 diffs)
- trunk/test/bin/prove.php (modified) (2 diffs)
- trunk/test/bootstrap/functional.php (modified) (1 diff)
- trunk/test/bootstrap/task.php (modified) (1 diff)
- trunk/test/bootstrap/unit.php (modified) (1 diff)
- trunk/test/functional/genericTest.php (modified) (2 diffs)
- trunk/test/functional/prodTest.php (modified) (1 diff)
- trunk/test/other/fixtures/test/functional/result-harness.txt (modified) (2 diffs)
- trunk/test/other/fixtures/test/result-harness.txt (modified) (2 diffs)
- trunk/test/other/tasksTest.php (modified) (4 diffs)
- trunk/test/unit/form/sfFormFieldSchemaTest.php (copied) (copied from branches/1.1/test/unit/form/sfFormFieldSchemaTest.php)
- trunk/test/unit/form/sfFormFieldTest.php (modified) (7 diffs)
- trunk/test/unit/form/sfFormTest.php (modified) (10 diffs)
- trunk/test/unit/response/sfWebResponseTest.php (modified) (3 diffs)
- trunk/test/unit/task/cache/sfCacheClearTaskTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorAllTest.php (deleted)
- trunk/test/unit/validator/sfValidatorAndTest.php (copied) (copied from branches/1.1/test/unit/validator/sfValidatorAndTest.php)
- trunk/test/unit/validator/sfValidatorAnyTest.php (deleted)
- trunk/test/unit/validator/sfValidatorBooleanTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorCSRFTokenTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorCallbackTest.php (modified) (4 diffs)
- trunk/test/unit/validator/sfValidatorChoiceManyTest.php (modified) (3 diffs)
- trunk/test/unit/validator/sfValidatorChoiceTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorDateTest.php (modified) (6 diffs)
- trunk/test/unit/validator/sfValidatorDecoratorTest.php (modified) (4 diffs)
- trunk/test/unit/validator/sfValidatorEmailTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorErrorSchemaTest.php (modified) (4 diffs)
- trunk/test/unit/validator/sfValidatorFileTest.php (modified) (4 diffs)
- trunk/test/unit/validator/sfValidatorIntegerTest.php (modified) (5 diffs)
- trunk/test/unit/validator/sfValidatorNumberTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorOrTest.php (copied) (copied from branches/1.1/test/unit/validator/sfValidatorOrTest.php)
- trunk/test/unit/validator/sfValidatorRegexTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorSchemaCompareTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorSchemaFilterTest.php (modified) (3 diffs)
- trunk/test/unit/validator/sfValidatorSchemaForEachTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorSchemaTest.php (modified) (8 diffs)
- trunk/test/unit/validator/sfValidatorStringTest.php (modified) (3 diffs)
- trunk/test/unit/validator/sfValidatorTest.php (modified) (2 diffs)
- trunk/test/unit/validator/sfValidatorUrlTest.php (modified) (2 diffs)
- trunk/test/unit/view/escaper/sfOutputEscaperArrayDecoratorTest.php (modified) (2 diffs)
- trunk/test/unit/view/escaper/sfOutputEscaperObjectDecoratorTest.php (modified) (2 diffs)
- trunk/test/unit/view/escaper/sfOutputEscaperSafeTest.php (copied) (copied from branches/1.1/test/unit/view/escaper/sfOutputEscaperSafeTest.php)
- trunk/test/unit/view/escaper/sfOutputEscaperTest.php (modified) (2 diffs)
- trunk/test/unit/view/sfEscapedViewParameterHolderTest.php (modified) (4 diffs)
- trunk/test/unit/view/sfViewParameterHolderTest.php (modified) (2 diffs)
- trunk/test/unit/widget/sfWidgetFormDateTest.php (modified) (4 diffs)
- trunk/test/unit/widget/sfWidgetFormDateTimeTest.php (modified) (5 diffs)
- trunk/test/unit/widget/sfWidgetFormSchemaDecoratorTest.php (modified) (4 diffs)
- trunk/test/unit/widget/sfWidgetFormSchemaForEachTest.php (modified) (2 diffs)
- trunk/test/unit/widget/sfWidgetFormSchemaTest.php (modified) (4 diffs)
- trunk/test/unit/widget/sfWidgetFormTimeTest.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/LICENSE
r355 r7131 1 Copyright (c) 2004-200 6Fabien Potencier1 Copyright (c) 2004-2008 Fabien Potencier 2 2 3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 3 Permission is hereby granted, free of charge, to any person obtaining a copy 4 of this software and associated documentation files (the "Software"), to deal 5 in the Software without restriction, including without limitation the rights 6 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 copies of the Software, and to permit persons to whom the Software is furnished 8 to do so, subject to the following conditions: 4 9 5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 The above copyright notice and this permission notice shall be included in all 11 copies or substantial portions of the Software. 6 12 7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 THE SOFTWARE. trunk/UPGRADE
r6779 r7131 388 388 param: 389 389 timeout: 1800 # session timeout in seconds 390 391 `php.yml` configuration file 392 ---------------------------- 393 394 The `php.yml` configuration file has been removed. 395 396 The only setting you will have to check by hand is `log_errors`, which was set to `on` by `php.yml`. 397 398 `php.yml` is replaced by the `check_configuration.php` utility you can find in `data/bin`. 399 It checks your environment against symfony requirements. You can launch it from anywhere: 400 401 $ php /path/to/symfony/data/bin/check_configuration.php 402 403 Even if you can use this utility from the command line, it's strongly recommended to launch it 404 from the web by copying it under your web root directory as PHP can use different php.ini configuration 405 files for the CLI and the web. trunk/data/bin/symfony.bat
r3129 r7131 21 21 22 22 IF EXIST ".\symfony" ( 23 %PHP_COMMAND% -d html_errors=off -d open_basedir= -q".\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %923 %PHP_COMMAND% ".\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9 24 24 ) ELSE ( 25 %PHP_COMMAND% -d html_errors=off -d open_basedir= -q"%SCRIPT_DIR%\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %925 %PHP_COMMAND% "%SCRIPT_DIR%\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9 26 26 ) 27 27 goto cleanup trunk/data/config/config_handlers.yml
r5384 r7131 1 1 config/autoload.yml: 2 2 class: sfAutoloadConfigHandler 3 4 config/php.yml:5 class: sfPhpConfigHandler6 3 7 4 config/databases.yml: … … 30 27 class: sfRoutingConfigHandler 31 28 32 config/i18n.yml:33 class: sfDefineEnvironmentConfigHandler34 param:35 prefix: sf_i18n_36 37 29 modules/*/config/generator.yml: 38 30 class: sfGeneratorConfigHandler … … 40 32 modules/*/config/view.yml: 41 33 class: sfViewConfigHandler 42 43 modules/*/config/mailer.yml:44 class: sfDefineEnvironmentConfigHandler45 param:46 prefix: sf_mailer_47 module: yes48 34 49 35 modules/*/config/security.yml: trunk/data/skeleton/module/test/actionsTest.php
r6224 r7131 5 5 // create a new test browser 6 6 $browser = new sfTestBrowser(); 7 $browser->initialize();8 7 9 8 $browser-> trunk/data/skeleton/project/web/.htaccess
r3246 r7131 9 9 10 10 # we skip all files with .something 11 RewriteCond %{REQUEST_URI} \..+$12 RewriteCond %{REQUEST_URI} !\.html$13 RewriteRule .* - [L]11 #RewriteCond %{REQUEST_URI} \..+$ 12 #RewriteCond %{REQUEST_URI} !\.html$ 13 #RewriteRule .* - [L] 14 14 15 15 # we check if the .html version is here (caching) trunk/lib/action/sfComponent.class.php
r6509 r7131 237 237 * Sets a variable for the template. 238 238 * 239 * @param string The variable name 240 * @param mixed The variable value 241 */ 242 public function setVar($name, $value) 243 { 244 $this->varHolder->set($name, $value); 239 * If you add a safe value, the variable won't be output escaped 240 * by symfony, so this is your responsability to ensure that the 241 * value is escaped properly. 242 * 243 * @param string The variable name 244 * @param mixed The variable value 245 * @param Boolean true if the value is safe for output (false by default) 246 */ 247 public function setVar($name, $value, $safe = false) 248 { 249 $this->varHolder->set($name, $safe ? new sfOutputEscaperSafe($value) : $value); 245 250 } 246 251 trunk/lib/config/sfDatabaseConfigHandler.class.php
r6779 r7131 50 50 51 51 // get a list of database connections 52 foreach ($myConfig as $ key=> $dbConfig)52 foreach ($myConfig as $name => $dbConfig) 53 53 { 54 54 // is this category already registered? 55 if (in_array($ key, $databases))55 if (in_array($name, $databases)) 56 56 { 57 57 // this category is already registered 58 throw new sfParseException(sprintf('Configuration file "%s" specifies previously registered category "%s".', $configFiles[0], $ key));58 throw new sfParseException(sprintf('Configuration file "%s" specifies previously registered category "%s".', $configFiles[0], $name)); 59 59 } 60 60 61 61 // add this database 62 $databases[] = $ key;62 $databases[] = $name; 63 63 64 64 // let's do our fancy work … … 66 66 { 67 67 // missing class key 68 throw new sfParseException(sprintf('Configuration file "%s" specifies category "%s" with missing class key.', $configFiles[0], $ key));68 throw new sfParseException(sprintf('Configuration file "%s" specifies category "%s" with missing class key.', $configFiles[0], $name)); 69 69 } 70 70 … … 72 72 { 73 73 // we have a file to include 74 $file = $this->replaceConstants($dbConfig['file']); 75 $file = $this->replacePath($file); 74 $file = $this->replacePath($this->replaceConstants($dbConfig['file'])); 76 75 77 76 if (!is_readable($file)) … … 86 85 87 86 // parse parameters 87 $parameters = array(); 88 88 if (isset($dbConfig['param'])) 89 89 { 90 foreach ($dbConfig['param'] as &$value)90 foreach ($dbConfig['param'] as $key => $value) 91 91 { 92 $ value= $this->replaceConstants($value);92 $parameters[$key] = $this->replaceConstants($value); 93 93 } 94 95 $parameters = var_export($dbConfig['param'], true);96 94 } 97 else 98 { 99 $parameters = 'null'; 100 } 95 $parameters['name'] = $name; 101 96 102 97 // append new data 103 $data[] = sprintf("\n\$database = new %s(%s, '%s');\n". 104 "\$this->databases['%s'] = \$database;", 105 $dbConfig['class'], $parameters, $key, $key); 98 $data[] = sprintf("\n\$this->databases['%s'] = new %s(%s);", $name, $dbConfig['class'], var_export($parameters, true)); 106 99 } 107 100 108 101 // compile data 109 $retval =sprintf("<?php\n".102 return sprintf("<?php\n". 110 103 "// auto-generated by sfDatabaseConfigHandler\n". 111 104 "// date: %s%s\n%s\n", 112 105 date('Y/m/d H:i:s'), implode("\n", $includes), implode("\n", $data)); 113 114 return $retval;115 106 } 116 107 } trunk/lib/config/sfLoader.class.php
r6779 r7131 414 414 } 415 415 416 /** 417 * Loads config.php files from plugins 418 * 419 * @return void 420 */ 416 421 static public function loadPluginConfig() 417 422 { 418 423 if ($pluginConfigs = glob(sfConfig::get('sf_symfony_lib_dir').'/plugins/*/config/config.php')) 419 424 { 425 foreach($pluginConfigs as $config) 426 { 427 require_once($config); 428 } 429 } 430 431 if ($pluginConfigs = glob(sfConfig::get('sf_plugins_dir').'/*/config/config.php')) 432 { 420 433 foreach ($pluginConfigs as $config) 421 434 { 422 include($config); 423 } 424 } 425 426 if ($pluginConfigs = glob(sfConfig::get('sf_plugins_dir').'/*/config/config.php')) 427 { 428 foreach ($pluginConfigs as $config) 429 { 430 include($config); 435 require_once($config); 431 436 } 432 437 } trunk/lib/controller/sfController.class.php
r6779 r7131 205 205 } 206 206 207 // track the requested module so we have access to the data in the error 404 page 208 $this->context->getRequest()->setAttribute('requested_action', $actionName); 209 $this->context->getRequest()->setAttribute('requested_module', $moduleName); 210 211 // switch to error 404 action 212 $moduleName = sfConfig::get('sf_error_404_module'); 213 $actionName = sfConfig::get('sf_error_404_action'); 214 215 if (!$this->actionExists($moduleName, $actionName)) 216 { 217 // cannot find unavailable module/action 218 throw new sfConfigurationException(sprintf('Invalid configuration settings: [sf_error_404_module] "%s", [sf_error_404_action] "%s".', $moduleName, $actionName)); 219 } 207 throw new sfError404Exception(sprintf('Action "%s/%s" does not exist.', $moduleName, $actionName)); 220 208 } 221 209 trunk/lib/exception/sfError404Exception.class.php
r6522 r7131 20 20 { 21 21 /** 22 * @see sfException22 * Forwards to the 404 action. 23 23 */ 24 public function asResponse()24 public function printStackTrace() 25 25 { 26 // log all exceptions in php log 27 $exception = is_null($this->wrappedException) ? $this : $this->wrappedException; 28 error_log($exception->getMessage()); 29 26 30 if (sfConfig::get('sf_debug')) 27 31 { 28 $response = parent::asResponse(); 29 $response->setStatusCode(404); 32 sfContext::getInstance()->getResponse()->setStatusCode(404); 33 34 return parent::printStackTrace(); 30 35 } 31 36 else … … 37 42 } 38 43 39 $context = sfContext::getInstance(); 40 $context->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); 41 $response = $context->getResponse(); 44 sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); 42 45 } 43 44 return $response;45 46 } 46 47 } trunk/lib/filter/sfBasicSecurityFilter.class.php
r6522 r7131 30 30 public function execute($filterChain) 31 31 { 32 // get the cool stuff 33 $controller = $this->context->getController(); 34 $user = $this->context->getUser(); 35 36 // get the current action instance 37 $actionEntry = $controller->getActionStack()->getLastEntry(); 38 $actionInstance = $actionEntry->getActionInstance(); 39 40 // disable security on [sf_login_module] / [sf_login_action] 32 // disable security on login and secure actions 41 33 if ( 42 34 (sfConfig::get('sf_login_module') == $this->context->getModuleName()) && (sfConfig::get('sf_login_action') == $this->context->getActionName()) … … 50 42 } 51 43 52 // get the credential required for this action53 $credential = $actionInstance->getCredential();54 55 // for this filter, the credentials are a simple privilege array56 // where the first index is the privilege name and the second index57 // is the privilege namespace58 //59 44 // NOTE: the nice thing about the Action class is that getCredential() 60 45 // is vague enough to describe any level of security and can be 61 46 // used to retrieve such data and should never have to be altered 62 if ($user->isAuthenticated()) 63 { 64 // the user is authenticated 65 if ($credential === null || $user->hasCredential($credential)) 66 { 67 // the user has access, continue 68 $filterChain->execute(); 69 } 70 else 71 { 72 // the user doesn't have access, exit stage left 73 $controller->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); 74 75 throw new sfStopException(); 76 } 77 } 78 else 47 if (!$this->context->getUser()->isAuthenticated()) 79 48 { 80 49 // the user is not authenticated 81 $controller->forward(sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action')); 50 $this->forwardToLoginAction(); 51 } 82 52 83 throw new sfStopException(); 53 // the user is authenticated 54 $credential = $this->getUserCredential(); 55 if (!is_null($credential) && !$this->context->getUser()->hasCredential($credential)) 56 { 57 // the user doesn't have access 58 $this->forwardToSecureAction(); 84 59 } 60 61 // the user has access, continue 62 $filterChain->execute(); 63 } 64 65 /** 66 * Forwards the current request to the secure action. 67 * 68 * @throws sfStopException 69 */ 70 protected function forwardToSecureAction() 71 { 72 $this->context->getController()->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); 73 74 throw new sfStopException(); 75 } 76 77 /** 78 * Forwards the current request to the login action. 79 * 80 * @throws sfStopException 81 */ 82 protected function forwardToLoginAction() 83 { 84 $this->context->getController()->forward(sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action')); 85 86 throw new sfStopException(); 87 } 88 89 /** 90 * Returns the credential required for this action. 91 * 92 * @return mixed The credential required for this action 93 */ 94 protected function getUserCredential() 95 { 96 return $this->context->getController()->getActionStack()->getLastEntry()->getActionInstance()->getCredential(); 85 97 } 86 98 } trunk/lib/form/sfForm.class.php
r6779 r7131 114 114 * @param array An array of uploaded files (in the $_FILES or $_GET format) 115 115 */ 116 public function bind( $taintedValues,$taintedFiles = array())116 public function bind(array $taintedValues = null, array $taintedFiles = array()) 117 117 { 118 118 $this->taintedValues = $taintedValues; … … 121 121 $this->resetFormFields(); 122 122 123 if (is_null($this->taintedValues)) 124 { 125 $this->taintedValues = array(); 126 } 127 123 128 try 124 129 { 125 $this->values = $this->validatorSchema->clean( array_merge($this->taintedValues, self::convertFileInformation($this->taintedFiles)));130 $this->values = $this->validatorSchema->clean($this->taintedValues + self::convertFileInformation($this->taintedFiles)); 126 131 $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); 127 132 … … 203 208 * @param string The field name 204 209 * @param sfForm A sfForm instance 205 * @param string The format to use for widget name206 210 * @param string A HTML decorator for the embedded form 207 211 */ 208 public function embedForm($name, sfForm $form, $nameFormat = null, $decorator = null) 209 { 210 // change the name format for the embedded widget 211 if (is_null($nameFormat)) 212 { 213 $nameFormat = $this->generateNameFormatForEmbedded($name, $this->widgetSchema->getNameFormat()); 214 } 215 212 public function embedForm($name, sfForm $form, $decorator = null) 213 { 216 214 $form = clone $form; 217 215 unset($form[self::$CSRFFieldName]); 218 216 219 217 $widgetSchema = $form->getWidgetSchema(); 220 $widgetSchema->setNameFormat($nameFormat);221 218 222 219 $this->setDefault($name, $form->getDefaults()); … … 235 232 * @param string The field name 236 233 * @param sfForm A sfForm instance 237 * @param integer The number of times to include the form 238 * @param string The format to use for widget name 234 * @param integer The number of times to embed the form 239 235 * @param string A HTML decorator for the main form around embedded forms 240 236 * @param string A HTML decorator for each embedded form 241 237 */ 242 public function embedFormForEach($name, sfForm $form, $n, $nameFormat = null, $decorator = null, $innerDecorator = null, $attributes = array(), $options = array(), $labels = array()) 243 { 244 // change the name format for the embedded widget 245 if (is_null($nameFormat)) 246 { 247 $nameFormat = $this->generateNameFormatForEmbedded($name, $this->widgetSchema->getNameFormat()); 248 } 249 238 public function embedFormForEach($name, sfForm $form, $n, $decorator = null, $innerDecorator = null, $attributes = array(), $options = array(), $labels = array()) 239 { 250 240 $form = clone $form; 251 241 unset($form[self::$CSRFFieldName]); 242 243 $widgetSchema = $form->getWidgetSchema(); 252 244 253 245 // generate labels and default values … … 257 249 if (!isset($labels[$i])) 258 250 { 259 $labels[$i] = sprintf('%s (%s)', $ form->getWidgetSchema()->generateLabelName($name), $i);251 $labels[$i] = sprintf('%s (%s)', $widgetSchema->generateLabelName($name), $i); 260 252 } 261 253 … … 265 257 $this->setDefault($name, $defaults); 266 258 267 $decorator = is_null($decorator) ? $ form->getWidgetSchema()->getFormFormatter()->getDecoratorFormat() : $decorator;268 $innerDecorator = is_null($innerDecorator) ? $ form->getWidgetSchema()->getFormFormatter()->getDecoratorFormat() : $innerDecorator;269 270 $this->widgetSchema[$name] = new sfWidgetFormSchemaDecorator(new sfWidgetFormSchemaForEach( $nameFormat, new sfWidgetFormSchemaDecorator($form->getWidgetSchema(), $innerDecorator), $n, $attributes, $options, $labels), $decorator);259 $decorator = is_null($decorator) ? $widgetSchema->getFormFormatter()->getDecoratorFormat() : $decorator; 260 $innerDecorator = is_null($innerDecorator) ? $widgetSchema->getFormFormatter()->getDecoratorFormat() : $innerDecorator; 261 262 $this->widgetSchema[$name] = new sfWidgetFormSchemaDecorator(new sfWidgetFormSchemaForEach(new sfWidgetFormSchemaDecorator($widgetSchema, $innerDecorator), $n, $attributes, $options, $labels), $decorator); 271 263 $this->validatorSchema[$name] = new sfValidatorSchemaForEach($form->getValidatorSchema(), $n); 272 264 … … 275 267 276 268 /** 269 * Sets the validators associated with this form. 270 * 271 * @param array An array of named validators 272 */ 273 public function setValidators(array $validators) 274 { 275 $this->setValidatorSchema(new sfValidatorSchema($validators)); 276 } 277 278 /** 277 279 * Sets the validator schema associated with this form. 278 280 * … … 294 296 { 295 297 return $this->validatorSchema; 298 } 299 300 /** 301 * Sets the widgets associated with this form. 302 * 303 * @param array An array of named widgets 304 */ 305 public function setWidgets(array $widgets) 306 { 307 $this->setWidgetSchema(new sfWidgetFormSchema($widgets)); 296 308 } 297 309 … … 389 401 { 390 402 $this->defaults = $defaults; 403 404 if (self::$CSRFProtection) 405 { 406 $this->setDefault(self::$CSRFFieldName, $this->getCSRFToken(self::$CSRFSecret)); 407 } 391 408 392 409 $this->resetFormFields(); … … 548 565 $values = $this->isBound ? $this->taintedValues : $this->defaults; 549 566 550 $this->formFields[$name] = new sfFormField($widget, $this->getFormField(), $name, isset($values[$name]) ? $values[$name] : null, $this->errorSchema[$name]); 567 $class = $widget instanceof sfWidgetFormSchema ? 'sfFormFieldSchema' : 'sfFormField'; 568 569 $this->formFields[$name] = new $class($widget, $this->getFormField(), $name, isset($values[$name]) ? $values[$name] : null, $this->errorSchema[$name]); 551 570 } 552 571 … … 584 603 * Returns a form field for the main widget schema. 585 604 * 586 * @return sfFormField A sfFormFieldinstance605 * @return sfFormFieldSchema A sfFormFieldSchema instance 587 606 */ 588 607 protected function getFormField() … … 590 609 if (is_null($this->formField)) 591 610 { 592 $this->formField = new sfFormField ($this->widgetSchema, null, null, $this->isBound ? $this->taintedValues : $this->defaults, $this->errorSchema);611 $this->formField = new sfFormFieldSchema($this->widgetSchema, null, null, $this->isBound ? $this->taintedValues : $this->defaults, $this->errorSchema); 593 612 } 594 613 … … 597 616 598 617 /** 599 * Generates a name format for embedded forms.600 *601 * @param string The widget name602 * @param string The current name format603 *604 * @return string The name format to use for embedding605 *606 * @see embedFormForEach()607 * @see embedForm()608 */609 protected function generateNameFormatForEmbedded($name, $nameFormat)610 {611 // if current name format is something[%s], change it to something[$name][%s]612 // else change it to $name[%s]613 if ('[%s]' === substr($nameFormat, -4))614 {615 return sprintf('%s[%s][%%s]', substr($nameFormat, 0, -4), $name);616 }617 else618 {619 return sprintf('%s[%%s]', $name);620 }621 }622 623 /**624 618 * Converts uploaded file array to a format following the $_GET and $POST naming convention. 625 619 * … … 630 624 * @return array An array of re-ordered uploaded file information 631 625 */ 632 static public function convertFileInformation( $taintedFiles)626 static public function convertFileInformation(array $taintedFiles) 633 627 { 634 628 return self::pathsToArray(preg_replace('#^(/[^/]+)?(/name|/type|/tmp_name|/error|/size)([^\s]*)( = [^\n]*)#m', '$1$3$2$4', self::arrayToPaths($taintedFiles))); … … 708 702 return $str; 709 703 } 704 705 public function __clone() 706 { 707 $this->widgetSchema = clone $this->widgetSchema; 708 $this->validatorSchema = clone $this->validatorSchema; 709 710 // we rebind the cloned form because Exceptions are not clonable 711 $this->bind($this->taintedValues, $this->taintedFiles); 712 } 710 713 } trunk/lib/form/sfFormField.class.php
r6196 r7131 17 17 * @version SVN: $Id$ 18 18 */ 19 class sfFormField implements ArrayAccess19 class sfFormField 20 20 { 21 21 protected … … 24 24 $name = '', 25 25 $value = null, 26 $error = null, 27 $fields = array(); 26 $error = null; 28 27 29 28 /** 30 29 * Constructor. 31 30 * 32 * @param sfWidget A sfWidget instance31 * @param sfWidgetForm A sfWidget instance 33 32 * @param sfFormField The sfFormField parent instance (null for the root widget) 34 33 * @param string The field name … … 36 35 * @param sfValidatorError A sfValidatorError instance 37 36 */ 38 public function __construct(sfWidget $widget, sfFormField $parent = null, $name, $value, sfValidatorError $error = null)37 public function __construct(sfWidgetForm $widget, sfFormField $parent = null, $name, $value, sfValidatorError $error = null) 39 38 { 40 39 $this->widget = $widget; … … 80 79 public function renderRow($help = '') 81 80 { 82 if ( $this->widget instanceof sfWidgetFormSchema)83 { 84 throw new LogicException( 'Unable to format a row on a sfWidgetFormSchema.');81 if (is_null($this->parent)) 82 { 83 throw new LogicException(sprintf('Unable to render the row for "%s".', $this->name)); 85 84 } 86 85 87 86 $field = $this->parent->getWidget()->renderField($this->name, $this->value, $this->error); 88 87 89 return strtr($this->parent->getWidget()->getFormFormatter()->formatRow($this->renderLabel(), $field, $this->error, $help), array('%hidden_fields%' => '')); 88 $error = $this->error instanceof sfValidatorErrorSchema ? $this->error->getGlobalErrors() : $this->error; 89 90 return strtr($this->parent->getWidget()->getFormFormatter()->formatRow($this->renderLabel(), $field, $error, $help), array('%hidden_fields%' => '')); 90 91 } 91 92 … … 95 96 * The formatted list will use the parent widget schema formatter. 96 97 * 97 * @param string The widget name98 *99 98 * @return string The formatted error list 100 99 */ 101 100 public function renderError() 102 101 { 103 if ($this->widget instanceof sfWidgetFormSchema) 104 { 105 throw new LogicException('Unable to format an error list on a sfWidgetFormSchema.'); 106 } 107 108 return $this->parent->getWidget()->getFormFormatter()->formatErrorsForRow($this->error); 102 if (is_null($this->parent)) 103 { 104 throw new LogicException(sprintf('Unable to render the error for "%s".', $this->name)); 105 } 106 107 $error = $this->error instanceof sfValidatorErrorSchema ? $this->error->getGlobalErrors() : $this->error; 108 109 return $this->parent->getWidget()->getFormFormatter()->formatErrorsForRow($error); 109 110 } 110 111 … … 116 117 public function renderLabel() 117 118 { 118 if ( $this->widget instanceof sfWidgetFormSchema)119 { 120 throw new LogicException( 'Unable to render a label on a sfWidgetFormSchema.');119 if (is_null($this->parent)) 120 { 121 throw new LogicException(sprintf('Unable to render the label for "%s".', $this->name)); 121 122 } 122 123 … … 131 132 public function renderLabelName() 132 133 { 133 if ( $this->widget instanceof sfWidgetFormSchema)134 { 135 throw new LogicException( 'Unable to render a label name on a sfWidgetFormSchema.');134 if (is_null($this->parent)) 135 { 136 throw new LogicException(sprintf('Unable to render the label name for "%s".', $this->name)); 136 137 } 137 138 … … 198 199 return !is_null($this->error) && count($this->error); 199 200 } 200 201 /**202 * Returns true if the bound field exists (implements the ArrayAccess interface).203 *204 * @param string The name of the bound field205 *206 * @return Boolean true if the widget exists, false otherwise207 */208 public function offsetExists($name)209 {210 return $this->widget instanceof sfWidgetFormSchema ? isset($this->widget[$name]) : false;211 }212 213 /**214 * Returns the form field associated with the name (implements the ArrayAccess interface).215 *216 * @param string The offset of the value to get217 *218 * @return sfFormField A form field instance219 */220 public function offsetGet($name)221 {222 if (!isset($this->fields[$name]))223 {224 if (!$this->widget instanceof sfWidgetFormSchema)225 {226 throw new LogicException(sprintf('Cannot get a form field on a non widget schema (%s given).', get_class($this->widget)));227 }228 229 if (is_null($widget = $this->widget[$name]))230 {231 throw new InvalidArgumentException(sprintf('Widget "%s" does not exist.', $name));232 }233 234 $this->fields[$name] = new sfFormField($widget, $this, $name, isset($this->value[$name]) ? $this->value[$name] : null, isset($this->error[$name]) ? $this->error[$name] : null);235 }236 237 return $this->fields[$name];238 }239 240 /**241 * Throws an exception saying that values cannot be set (implements the ArrayAccess interface).242 *243 * @param string (ignored)244 * @param string (ignored)245 *246 * @throws <b>LogicException</b>247 */248 public function offsetSet($offset, $value)249 {250 throw new LogicException('Cannot update form fields (read-only).');251 }252 253 /**254 * Throws an exception saying that values cannot be unset (implements the ArrayAccess interface).255 *256 * @param string (ignored)257 *258 * @throws LogicException259 */260 public function offsetUnset($offset)261 {262 throw new LogicException('Cannot remove form fields (read-only).');263 }264 201 } trunk/lib/generator/sfAdminGenerator.class.php
r5102 r7131 709 709 } 710 710 711 public function getFormObject() 712 { 713 $class = $this->getClassName().'Form'; 714 715 return new $class(); 716 } 717 718 public function getHiddenFields() 719 { 720 $form = $this->getFormObject(); 721 $hiddenFields = array(); 722 foreach ($form->getWidgetSchema()->getPositions() as $name) 723 { 724 if ($form[$name]->isHidden()) 725 { 726 $hiddenFields[] = $name; 727 } 728 } 729 730 return $hiddenFields; 731 } 732 733 public function getHiddenFieldsAsString() 734 { 735 $hiddenFields = ''; 736 foreach ($this->getHiddenFields() as $name) 737 { 738 $hiddenFields .= ' [?php echo $form[\''.$name.'\'] ?]'."\n"; 739 } 740 741 return "\n".$hiddenFields; 742 } 743 744 public function getLastNonHiddenField() 745 { 746 $form = $this->getFormObject(); 747 $positions = $form->getWidgetSchema()->getPositions(); 748 $last = count($positions) - 1; 749 for ($i = count($positions) - 1; $i >= 0; $i--) 750 { 751 if ($form[$positions[$i]]->isHidden()) 752 { 753 $last = $i - 1; 754 } 755 else 756 { 757 break; 758 } 759 } 760 761 return $last; 762 } 763 711 764 /** 712 765 * Escapes a string. trunk/lib/generator/sfCrudGenerator.class.php
r5098 r7131 96 96 * @return string The PHP code 97 97 */ 98 public function getRetrieveByPkParamsForAction($indent )98 public function getRetrieveByPkParamsForAction($indent, $callee = '$this->getRequestParameter') 99 99 { 100 100 $params = array(); 101 101 foreach ($this->getPrimaryKey() as $pk) 102 102 { 103 $params[] = "\$this->getRequestParameter('".sfInflector::underscore($pk->getPhpName())."')"; 103 $params[] = "$callee('".sfInflector::underscore($pk->getPhpName())."')"; 104 } 105 106 return implode(",\n".str_repeat(' ', max(0, $indent - strlen($this->singularName.$this->className))), $params); 107 } 108 109 /** 110 * Returns PHP code for primary keys parameters. 111 * 112 * @param integer The indentation value 113 * 114 * @return string The PHP code 115 */ 116 public function getRetrieveByPkParamsForEdit($indent, $prefix) 117 { 118 $params = array(); 119 foreach ($this->getPrimaryKey() as $pk) 120 { 121 $name = sfInflector::underscore($pk->getPhpName()); 122 // $params[] = sprintf("\$request->getParameter('%s', \$request->getParameter('%s'))", sprintf('%s[%s]', $prefix, $name), $name); 123 $params[] = sprintf("\$request->getParameter('%s')", $name); 104 124 } 105 125 trunk/lib/i18n/sfChoiceFormat.class.php
r4341 r7131 53 53 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 54 54 * @version v1.0, last update on Fri Dec 24 20:46:16 EST 2004 55 * @package System.I18N.core 55 * @package symfony 56 * @subpackage i18n 56 57 */ 57 58 class sfChoiceFormat trunk/lib/i18n/sfCultureInfo.class.php
r6376 r7131 47 47 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 48 48 * @version v1.0, last update on Sat Dec 04 13:41:46 EST 2004 49 * @package System.I18N.core 49 * @package symfony 50 * @subpackage i18n 50 51 */ 51 52 class sfCultureInfo trunk/lib/i18n/sfDateFormat.class.php
r4343 r7131 35 35 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 36 36 * @version v1.0, last update on Sat Dec 04 14:10:49 EST 2004 37 * @package System.I18N.core 37 * @package symfony 38 * @subpackage i18n 38 39 */ 39 40 class sfDateFormat trunk/lib/i18n/sfDateTimeFormatInfo.class.php
r5773 r7131 69 69 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 70 70 * @version v1.0, last update on Fri Dec 03 22:30:31 EST 2004 71 * @package System.I18N.core 71 * @package symfony 72 * @subpackage i18n 72 73 */ 73 74 class sfDateTimeFormatInfo trunk/lib/i18n/sfIMessageSource.class.php
r4580 r7131 29 29 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 30 30 * @version v1.0, last update on Fri Dec 24 17:40:19 EST 2004 31 * @package System.I18N.core 31 * @package symfony 32 * @subpackage i18n 32 33 */ 33 34 interface sfIMessageSource trunk/lib/i18n/sfMessageFormat.class.php
r4576 r7131 41 41 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 42 42 * @version v1.0, last update on Fri Dec 24 20:46:16 EST 2004 43 * @package System.I18N.core 43 * @package symfony 44 * @subpackage i18n 44 45 */ 45 46 class sfMessageFormat trunk/lib/i18n/sfMessageSource.class.php
r4590 r7131 59 59 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 60 60 * @version v1.0, last update on Fri Dec 24 19:55:49 EST 2004 61 * @package System.I18N.core 61 * @package symfony 62 * @subpackage i18n 62 63 */ 63 64 abstract class sfMessageSource implements sfIMessageSource trunk/lib/i18n/sfMessageSource_Database.class.php
r4580 r7131 26 26 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 27 27 * @version v1.0, last update on Fri Dec 24 16:18:44 EST 2004 28 * @package System.I18N.core 28 * @package symfony 29 * @subpackage i18n 29 30 */ 30 31 abstract class sfMessageSource_Database extends sfMessageSource trunk/lib/i18n/sfMessageSource_File.class.php
r4580 r7131 26 26 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 27 27 * @version v1.0, last update on Fri Dec 24 16:18:44 EST 2004 28 * @package System.I18N.core 28 * @package symfony 29 * @subpackage i18n 29 30 */ 30 31 abstract class sfMessageSource_File extends sfMessageSource trunk/lib/i18n/sfMessageSource_MySQL.class.php
r5770 r7131 87 87 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 88 88 * @version v1.0, last update on Fri Dec 24 16:58:58 EST 2004 89 * @package System.I18N.core 89 * @package symfony 90 * @subpackage i18n 90 91 */ 91 92 class sfMessageSource_MySQL extends sfMessageSource_Database trunk/lib/i18n/sfMessageSource_SQLite.class.php
r4590 r7131 83 83 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 84 84 * @version v1.0, last update on Fri Dec 24 16:58:58 EST 2004 85 * @package System.I18N.core 85 * @package symfony 86 * @subpackage i18n 86 87 */ 87 88 class sfMessageSource_SQLite extends sfMessageSource_Database trunk/lib/i18n/sfMessageSource_XLIFF.class.php
r4590 r7131 32 32 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 33 33 * @version v1.0, last update on Fri Dec 24 16:18:44 EST 2004 34 * @package System.I18N.core 34 * @package symfony 35 * @subpackage i18n 35 36 */ 36 37 class sfMessageSource_XLIFF extends sfMessageSource_File trunk/lib/i18n/sfMessageSource_gettext.class.php
r4590 r7131 29 29 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 30 30 * @version v1.0, last update on Fri Dec 24 16:18:44 EST 2004 31 * @package System.I18N.core 31 * @package symfony 32 * @subpackage i18n 32 33 */ 33 34 class sfMessageSource_gettext extends sfMessageSource_File trunk/lib/i18n/sfNumberFormat.class.php
r5773 r7131 59 59 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 60 60 * @version v1.0, last update on Fri Dec 10 18:10:20 EST 2004 61 * @package System.I18N.core 61 * @package symfony 62 * @subpackage i18n 62 63 */ 63 64 class sfNumberFormat trunk/lib/i18n/sfNumberFormatInfo.class.php
r5773 r7131 40 40 * @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com> 41 41 * @version v1.0, last update on Sun Dec 05 14:48:26 EST 2004 42 * @package System.I18N.core 42 * @package symfony 43 * @subpackage i18n 43 44 */ 44 45 class sfNumberFormatInfo trunk/lib/log/sfWebDebugLogger.class.php
r6591 r7131 4 4 * This file is part of the symfony package. 5 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 6 * 7 7 * For the full copyright and license information, please view the LICENSE 8 8 * file that was distributed with this source code. … … 35 35 public function initialize(sfEventDispatcher $dispatcher, $options = array()) 36 36 { 37 $this->webDebug = new sfWebDebug();38 37 $this->context = sfContext::getInstance(); 39 38 $this->dispatcher = $dispatcher; 40 39 41 40 $dispatcher->connect('response.filter_content', array($this, 'filterResponseContent')); 41 42 if(is_null($this->webDebug)) 43 { 44 $this->webDebug = $this->context->has('sf_web_debug') ? $this->context->get('sf_web_debug') : new sfWebDebug(); 45 } 46 47 $this->context->set('sf_web_debug', $this->webDebug); 42 48 43 49 if (isset($options['xdebug_logging'])) … … 90 96 91 97 // add needed assets for the web debug toolbar 92 $root = $this->context->getRequest()->getRelativeUrlRoot(); 98 $root = $this->context->getRequest()->getRelativeUrlRoot(); 93 99 $assets = sprintf(' 94 100 <script type="text/javascript" src="%s"></script> … … 121 127 // if we have xdebug and dev has not disabled the feature, add some stack information 122 128 $debugStack = array(); 123 if ( function_exists('xdebug_get_function_stack') && $this->xdebugLogging)129 if ($this->xdebugLogging && function_exists('xdebug_get_function_stack')) 124 130 { 125 131 foreach (xdebug_get_function_stack() as $i => $stack) trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelAdmin/default/template/actions/actions.class.php
r5102 r7131 106 106 $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); 107 107 108 if ($this->getRequest()-> getMethod() == sfRequest::POST)108 if ($this->getRequest()->isMethod('post')) 109 109 { 110 110 $this->update<?php echo $this->getClassName() ?>FromRequest(); trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/skeleton/config/generator.yml
r500 r7131 4 4 model_class: ##MODEL_CLASS## 5 5 theme: default 6 7 ##CONFIG## trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/actions/actions.class.php
r4334 r7131 2 2 3 3 /** 4 * <?php echo $this->get GeneratedModuleName() ?> actions.4 * <?php echo $this->getModuleName() ?> actions. 5 5 * 6 6 * @package ##PROJECT_NAME## 7 * @subpackage <?php echo $this->get GeneratedModuleName() ?>7 * @subpackage <?php echo $this->getModuleName() ?> 8 8 9 9 * @author ##AUTHOR_NAME## … … 14 14 public function executeIndex() 15 15 { 16 return $this->forward('<?php echo $this->getModuleName() ?>', 'list');16 $this-><?php echo $this->getSingularName() ?>List = <?php echo $this->getClassName() ?>Peer::doSelect(new Criteria()); 17 17 } 18 18 19 public function executeList() 19 <?php if (isset($this->params['with_show']) && $this->params['with_show']): ?> 20 public function executeShow($request) 20 21 { 21 $this-><?php echo $this->getPluralName() ?> = <?php echo $this->getClassName() ?>Peer::doSelect(new Criteria()); 22 } 23 24 public function executeShow() 25 { 26 $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49) ?>); 22 $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49, '$request->getParameter') ?>); 27 23 $this->forward404Unless($this-><?php echo $this->getSingularName() ?>); 28 24 } 29 25 26 <?php endif; ?> 27 <?php if (isset($this->params['non_atomic_actions']) && $this->params['non_atomic_actions']): ?> 28 public function executeEdit($request) 29 { 30 $this->form = new <?php echo $this->getClassName() ?>Form(<?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForEdit(49, $this->getSingularName()) ?>)); 31 32 if ($request->isMethod('post')) 33 { 34 $this->form->bind($request->getParameter('<?php echo $this->getSingularName() ?>')); 35 if ($this->form->isValid()) 36 { 37 $<?php echo $this->getSingularName() ?> = $this->form->save(); 38 39 $this->redirect('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>); 40 } 41 } 42 } 43 <?php else: ?> 30 44 public function executeCreate() 31 45 { 32 $this-> <?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>();46 $this->form = new <?php echo $this->getClassName() ?>Form(); 33 47 34 48 $this->setTemplate('edit'); 35 49 } 36 50 37 public function executeEdit( )51 public function executeEdit($request) 38 52 { 39 $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49) ?>); 40 $this->forward404Unless($this-><?php echo $this->getSingularName() ?>); 53 $this->form = new <?php echo $this->getClassName() ?>Form(<?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49, '$request->getParameter') ?>)); 41 54 } 42 55 43 public function executeUpdate( )56 public function executeUpdate($request) 44 57 { 45 if (<?php echo $this->getTestPksForGetOrCreate(false) ?>) 58 $this->forward404Unless($request->isMethod('post')); 59 60 $this->form = new <?php echo $this->getClassName() ?>Form(<?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49, '$request->getParameter') ?>)); 61 62 $this->form->bind($this->getRequestParameter('<?php echo $this->getSingularName() ?>')); 63 if ($this->form->isValid()) 46 64 { 47 $<?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>(); 48 } 49 else 50 { 51 $<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(45) ?>); 52 $this->forward404Unless($<?php echo $this->getSingularName() ?>); 65 $<?php echo $this->getSingularName() ?> = $this->form->save(); 66 67 $this->redirect('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>); 53 68 } 54 69 55 <?php foreach ($this->getTableMap()->getColumns() as $name => $column): $type = $column->getCreoleType(); ?> 56 <?php if ($name == 'CREATED_AT' || $name == 'UPDATED_AT') continue ?> 57 <?php $name = sfInflector::underscore($column->getPhpName()) ?> 58 <?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?> 59 if ($this->getRequestParameter('<?php echo $name ?>')) 60 { 61 list($d, $m, $y) = $this->getContext()->getI18N()->getDateForCulture($this->getRequestParameter('<?php echo $name ?>'), $this->getUser()->getCulture()); 62 $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>("$y-$m-$d"); 63 } 64 <?php elseif ($type == CreoleTypes::BOOLEAN): ?> 65 $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>', 0)); 66 <?php elseif ($column->isForeignKey()): ?> 67 $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>') ? $this->getRequestParameter('<?php echo $name ?>') : null); 68 <?php else: ?> 69 $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>')); 70 $this->setTemplate('edit'); 71 } 70 72 <?php endif; ?> 71 <?php endforeach; ?>72 73 73 $<?php echo $this->getSingularName() ?>->save(); 74 75 return $this->redirect('<?php echo $this->getModuleName() ?>/show?<?php echo $this->getPrimaryKeyUrlParams() ?>); 76 <?php //' ?> 77 } 78 79 public function executeDelete() 74 public function executeDelete($request) 80 75 { 81 $<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43) ?>); 82 83 $this->forward404Unless($<?php echo $this->getSingularName() ?>); 76 $this->forward404Unless($<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43, '$request->getParameter') ?>)); 84 77 85 78 $<?php echo $this->getSingularName() ?>->delete(); 86 79 87 return $this->redirect('<?php echo $this->getModuleName() ?>/list');80 $this->redirect('<?php echo $this->getModuleName() ?>/index'); 88 81 } 89 82 } trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/templates/editSuccess.php
r2726 r7131 1 [?php use_helper('Object') ?] 1 <?php $form = $this->getFormObject() ?> 2 [?php $<?php echo $this->getSingularName() ?> = $form->getObject() ?] 3 <h1>[?php echo $<?php echo $this->getSingularName() ?>->isNew() ? 'New' : 'Edit' ?] <?php echo sfInflector::humanize($this->getModuleName()) ?></h1> 2 4 3 [?php echo form_tag('<?php echo $this->getModuleName() ?>/update') ?] 5 <form action="[?php echo url_for('<?php echo $this->getModuleName() ?>/<?php echo isset($this->params['non_atomic_actions']) && $this->params['non_atomic_actions'] ? 'edit' : 'update' ?>'.(!$<?php echo $this->getSingularName() ?>->isNew() ? '?<?php echo $this->getPrimaryKeyUrlParams() ?> : '')) ?]" method="post" [?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?]> 6 <table> 7 <tfoot> 8 <tr> 9 <td colspan="2"> 10 <a href="[?php echo url_for('<?php echo $this->getModuleName() ?>/index') ?]">Cancel</a> 11 [?php if (!$<?php echo $this->getSingularName() ?>->isNew()): ?] 12 [?php echo link_to('Delete', '<?php echo $this->getModuleName() ?>/delete?<?php echo $this->getPrimaryKeyUrlParams() ?>, array('post' => true, 'confirm' => 'Are you sure?')) ?] 13 [?php endif; ?] 14 <input type="submit" value="Save" /> 15 </td> 16 </tr> 17 </tfoot> 18 <tbody> 19 <?php if (isset($this->params['non_verbose_templates']) && $this->params['non_verbose_templates']): ?> 20 [?php echo $form ?] 21 <?php else: ?> 4 22 5 <?php foreach ($this->getPrimaryKey() as $pk): ?> 6 [?php echo object_input_hidden_tag($<?php echo $this->getSingularName() ?>, 'get<?php echo $pk->getPhpName() ?>') ?] 23 <?php foreach ($form->getWidgetSchema()->getPositions() as $i => $name): ?> 24 <?php if ($form[$name]->isHidden()) continue ?> 25 <tr> 26 <th><?php echo $form[$name]->renderLabel() ?></th> 27 <td> 28 [?php echo $form['<?php echo $name ?>']->renderError() ?] 29 [?php echo $form['<?php echo $name ?>'] ?] 30 <?php $i == $this->getLastNonHiddenField() and print $this->getHiddenFieldsAsString() ?> 31 </td> 32 </tr> 7 33 <?php endforeach; ?> 8 9 <table> 10 <tbody> 11 <?php foreach ($this->getTableMap()->getColumns() as $name => $column): ?> 12 <?php if ($column->isPrimaryKey()) continue ?> 13 <?php if ($name == 'CREATED_AT' || $name == 'UPDATED_AT') continue ?> 14 <tr> 15 <th><?php echo sfInflector::humanize(sfInflector::underscore($column->getPhpName())) ?><?php if ($column->isNotNull()): ?>*<?php endif; ?>:</th> 16 <td>[?php echo <?php echo $this->getCrudColumnEditTag($column) ?> ?]</td> 17 </tr> 18 <?php endforeach; ?> 19 </tbody> 20 </table> 21 <hr /> 22 [?php echo submit_tag('save') ?] 23 [?php if (<?php echo $this->getPrimaryKeyIsSet() ?>): ?] 24 [?php echo link_to('delete', '<?php echo $this->getModuleName() ?>/delete?<?php echo $this->getPrimaryKeyUrlParams() ?>, 'post=true&confirm=Are you sure?') ?] 25 [?php echo link_to('cancel', '<?php echo $this->getModuleName() ?>/show?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?] 26 [?php else: ?] 27 [?php echo link_to('cancel', '<?php echo $this->getModuleName() ?>/list') ?] 28 [?php endif; ?] 34 <?php endif; ?> 35 </tbody> 36 </table> 29 37 </form> trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelCrud/default/template/templates/showSuccess.php
r1228 r7131 1 1 <table> 2 <tbody>2 <tbody> 3 3 <?php foreach ($this->getTableMap()->getColumns() as $column): ?> 4 <tr>5 <th><?php echo sfInflector::humanize(sfInflector::underscore($column->getPhpName())) ?>:</th>6 <td>[?= $<?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>() ?]</td>7 </tr>4 <tr> 5 <th><?php echo sfInflector::humanize(sfInflector::underscore($column->getPhpName())) ?>:</th> 6 <td>[?= $<?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>() ?]</td> 7 </tr> 8 8 <?php endforeach; ?> 9 </tbody>9 </tbody> 10 10 </table> 11 11 12 <hr /> 12 [?php echo link_to('edit', '<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?] 13 [?php echo link_to('list', '<?php echo $this->getModuleName() ?>/list') ?] 13 14 <a href="[?php echo url_for('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]">Edit</a> 15 16 <a href="[?php echo url_for('<?php echo $this->getModuleName() ?>/index') ?]">List</a> trunk/lib/plugins/sfPropelPlugin/data/generator/sfPropelForm/default/template/sfPropelFormGeneratedTemplate.php
r6174 r7131 13 13 public function setup() 14 14 { 15 $this->setWidget Schema(new sfWidgetFormSchema(array(15 $this->setWidgets(array( 16 16 <?php foreach ($this->table->getColumns() as $column): ?> 17 17 '<?php echo strtolower($column->getColumnName()) ?>'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($column->getColumnName())) ?> => new <?php echo $this->getWidgetClassForColumn($column) ?>(<?php echo $this->getWidgetOptionsForColumn($column) ?>), 18 18 <?php endforeach; ?> 19 19 <?php foreach ($this->getManyToManyTables() as $tables): ?> 20 '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfWidgetFormSelectMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables[' relatedTable']->getPhpName() ?>Choices')))),20 '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfWidgetFormSelectMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables['middleTable']->getPhpName() ?>Choices')))), 21 21 <?php endforeach; ?> 22 )) );22 )); 23 23 24 $this->setValidator Schema(new sfValidatorSchema(array(24 $this->setValidators(array( 25 25 <?php foreach ($this->table->getColumns() as $column): ?> 26 26 '<?php echo strtolower($column->getColumnName()) ?>'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($column->getColumnName())) ?> => new <?php echo $this->getValidatorClassForColumn($column) ?>(<?php echo $this->getValidatorOptionsForColumn($column) ?>), 27 27 <?php endforeach; ?> 28 28 <?php foreach ($this->getManyToManyTables() as $tables): ?> 29 '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfValidatorChoiceMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables[' relatedTable']->getPhpName() ?>IdentifierChoices')))),29 '<?php echo $tables['relatedTable']->getName() ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($tables['relatedTable']->getName().'_list')) ?> => new sfValidatorChoiceMany(array('choices' => new sfCallable(array($this, 'get<?php echo $tables['middleTable']->getPhpName() ?>IdentifierChoices')), 'required' => false)), 30 30 <?php endforeach; ?> 31 )) );31 )); 32 32 33 33 $this->widgetSchema->setNameFormat('<?php echo $this->table->getName() ?>[%s]'); … … 55 55 <?php endif; ?> 56 56 57 <?php foreach ($this->getForeignKeyNames() as $ name):?>57 <?php foreach ($this->getForeignKeyNames() as $info): $name = $info[1] ?> 58 58 public function get<?php echo $name ?>IdentifierChoices() 59 59 { … … 65 65 if (!isset($this-><?php echo $name ?>Choices)) 66 66 { 67 $this-><?php echo $name ?>Choices = array( );68 foreach (<?php echo $ name?>Peer::doSelect(new Criteria(), $this->getConnection()) as $object)67 $this-><?php echo $name ?>Choices = array(<?php !$info[2] && !$info[3] and print "'' => ''" ?>); 68 foreach (<?php echo $info[0] ?>Peer::doSelect(new Criteria(), $this->getConnection()) as $object) 69 69 { 70 70 $this-><?php echo $name ?>Choices[$object->get<?php echo $this->getPrimaryKey()->getPhpName() ?>()] = $object->__toString(); trunk/lib/plugins/sfPropelPlugin/lib/creole/drivers/sfDebugConnection.php
r6379 r7131 22 22 * DebugConnection. 23 23 * 24 * @author Michael Sims 25 * @package creole.drivers.debug 24 * @package symfony 25 * @subpackage creole 26 * @author Michael Sims 26 27 */ 27 28 class sfDebugConnection implements Connection trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfExtensionObjectBuilder.php
r2624 r7131 13 13 /** 14 14 * @package symfony 15 * @subpackage addon15 * @subpackage propel 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfExtensionPeerBuilder.php
r2624 r7131 13 13 /** 14 14 * @package symfony 15 * @subpackage addon15 * @subpackage propel 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfMapBuilderBuilder.php
r3058 r7131 13 13 /** 14 14 * @package symfony 15 * @subpackage addon15 * @subpackage propel 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfMultiExtendObjectBuilder.php
r1919 r7131 13 13 /** 14 14 * @package symfony 15 * @subpackage addon15 * @subpackage propel 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfObjectBuilder.php
r6779 r7131 13 13 /** 14 14 * @package symfony 15 * @subpackage addon15 * @subpackage propel 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php
r6779 r7131 13 13 /** 14 14 * @package symfony 15 * @subpackage addon15 * @subpackage propel 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/propel/database/sfPropelDatabase.class.php
r6370 r7131 32 32 $config = array(); 33 33 34 public function initialize($parameters = null , $name = 'propel')34 public function initialize($parameters = null) 35 35 { 36 36 parent::initialize($parameters); … … 38 38 if (!$this->hasParameter('datasource')) 39 39 { 40 $this->setParameter('datasource', $ name);40 $this->setParameter('datasource', $this->getParameter('name', 'propel')); 41 41 } 42 42 trunk/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php
r6174 r7131 137 137 * This method does not returns foreign keys that are also primary keys. 138 138 * 139 * @return array An array of foreign key PHP names 139 * @return array An array composed of: 140 * * The foreign table PHP name 141 * * The foreign key PHP name 142 * * A Boolean to indicate whether the column is required or not 143 * * A Boolean to indicate whether the column is a many to many relationship or not 140 144 */ 141 145 public function getForeignKeyNames() … … 146 150 if (!$column->isPrimaryKey() && $column->isForeignKey()) 147 151 { 148 $names[] = $this->getForeignTable($column)->getPhpName();152 $names[] = array($this->getForeignTable($column)->getPhpName(), $column->getPhpName(), $column->isNotNull(), false); 149 153 } 150 154 } … … 152 156 foreach ($this->getManyToManyTables() as $tables) 153 157 { 154 $names[] = $tables['relatedTable']->getPhpName();158 $names[] = array($tables['relatedTable']->getPhpName(), $tables['middleTable']->getPhpName(), false, true); 155 159 } 156 160 … … 241 245 if (!$column->isPrimaryKey() && $column->isForeignKey()) 242 246 { 243 $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sChoices\'))', $ this->getForeignTable($column)->getPhpName());247 $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sChoices\'))', $column->getPhpName()); 244 248 } 245 249 … … 327 331 if (!$column->isPrimaryKey() && $column->isForeignKey()) 328 332 { 329 $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sIdentifierChoices\'))', $ this->dbMap->getTable($column->getRelatedTableName())->getPhpName());333 $options[] = sprintf('\'choices\' => new sfCallable(array($this, \'get%sIdentifierChoices\'))', $column->getPhpName()); 330 334 } 331 335 trunk/lib/plugins/sfPropelPlugin/lib/propel/sfFormPropel.class.php
r6175 r7131 11 11 /** 12 12 * @package symfony 13 * @subpackage propel13 * @subpackage form 14 14 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 15 15 * @version SVN: $Id$ … … 20 20 * 21 21 * @package symfony 22 * @subpackage propel22 * @subpackage form 23 23 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 24 24 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelAutoload.php
r5868 r7131 11 11 /** 12 12 * @package symfony 13 * @subpackage addon13 * @subpackage propel 14 14 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 15 15 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelBehavior.class.php
r2453 r7131 11 11 /** 12 12 * @package symfony 13 * @subpackage addon13 * @subpackage propel 14 14 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 15 15 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelData.class.php
r6020 r7131 10 10 11 11 /** 12 * This class is the Propel implementation of sfData. It interacts with the data source 13 * and loads data. 12 * This class is the Propel implementation of sfData. 13 * 14 * It interacts with the data source and loads data. 14 15 * 15 16 * @package symfony 16 * @subpackage addon17 * @subpackage propel 17 18 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 18 19 * @version SVN: $Id$ … … 21 22 { 22 23 protected 23 $maps = array(),24 24 $deletedClasses = array(), 25 25 $con = null; 26 26 27 // symfony load-data (file|dir)28 27 /** 29 28 * Loads data from a file or directory into a Propel data source … … 37 36 { 38 37 $fixture_files = $this->getFiles($directory_or_file); 38 39 // load map classes 40 $this->loadMapBuilders(); 41 $this->dbMap = Propel::getDatabaseMap($connectionName); 39 42 40 43 // wrap all database operations in a single transaction … … 80 83 $peer_class = $class.'Peer'; 81 84 82 // load map class 83 $this->loadMapBuilder($class); 84 85 $tableMap = $this->maps[$class]->getDatabaseMap()->getTable(constant($peer_class.'::TABLE_NAME')); 85 $tableMap = $this->dbMap->getTable(constant($peer_class.'::TABLE_NAME')); 86 86 87 87 $column_names = call_user_func_array(array($peer_class, 'getFieldNames'), array(BasePeer::TYPE_FIELDNAME)); … … 111 111 foreach ($data as $name => $value) 112 112 { 113 // will need to be updated for Propel 1.3 114 if (is_array($value) && 's' == substr($name, -1)) 115 { 116 // many to many relationship 117 $this->loadMany2Many($obj, substr($name, 0, -1), $value); 118 119 continue; 120 } 121 113 122 $isARealColumn = true; 114 123 try … … 126 135 if ($column->isForeignKey() && !is_null($value)) 127 136 { 128 $relatedTable = $this-> maps[$class]->getDatabaseMap()->getTable($column->getRelatedTableName());137 $relatedTable = $this->dbMap->getTable($column->getRelatedTableName()); 129 138 if (!isset($this->object_references[$relatedTable->getPhpName().'_'.$value])) 130 139 { 131 140 throw new sfException(sprintf('The object "%s" from class "%s" is not defined in your data file.', $value, $relatedTable->getPhpName())); 132 141 } 133 $value = $this->object_references[$relatedTable->getPhpName().'_'.$value] ;142 $value = $this->object_references[$relatedTable->getPhpName().'_'.$value]->getPrimaryKey(); 134 143 } 135 144 } … … 150 159 $obj->save($this->con); 151 160 152 // save the idfor future reference161 // save the object for future reference 153 162 if (method_exists($obj, 'getPrimaryKey')) 154 163 { 155 $this->object_references[$class.'_'.$key] = $obj->getPrimaryKey(); 156 } 157 } 164 $this->object_references[$class.'_'.$key] = $obj; 165 } 166 } 167 } 168 } 169 170 /** 171 * Loads many to many objects. 172 * 173 * @param BaseObject A Propel object 174 * @param string The middle table name 175 * @param array An array of values 176 */ 177 protected function loadMany2Many($obj, $middleTableName, $values) 178 { 179 $middleTable = $this->dbMap->getTable($middleTableName); 180 $middleClass = $middleTable->getPhpName(); 181 foreach ($middleTable->getColumns() as $column) 182 { 183 if ($column->isPrimaryKey() && $column->isForeignKey() && constant(get_class($obj).'Peer::TABLE_NAME') != $column->getRelatedTableName()) 184 { 185 $relatedClass = $this->dbMap->getTable($column->getRelatedTableName())->getPhpName(); 186 break; 187 } 188 } 189 190 if (!isset($relatedClass)) 191 { 192 throw new sfException(sprintf('Unable to find the many-to-many relationship for object "%s"', get_class($obj))); 193 } 194 195 $setter = 'set'.get_class($obj); 196 $relatedSetter = 'set'.$relatedClass; 197 198 foreach ($values as $value) 199 { 200 if (!isset($this->object_references[$relatedClass.'_'.$value])) 201 { 202 throw new sfException(sprintf('The object "%s" from class "%s" is not defined in your data file.', $value, $relatedClass)); 203 } 204 205 $middle = new $middleClass(); 206 $middle->$setter($obj); 207 $middle->$relatedSetter($this->object_references[$relatedClass.'_'.$value]); 208 $middle->save(); 158 209 } 159 210 } … … 214 265 215 266 /** 216 * Loads the mappings for the classes 217 * 218 * @param string The model class name 267 * Loads all map builders. 219 268 * 220 269 * @throws sfException If the class cannot be found 221 270 */ 222 protected function loadMapBuilder($class) 223 { 224 $mapBuilderClass = $class.'MapBuilder'; 225 if (!isset($this->maps[$class])) 226 { 227 if (!$classPath = sfAutoload::getInstance()->getClassPath($mapBuilderClass)) 228 { 229 throw new sfException(sprintf('Unable to find path for class "%s".', $mapBuilderClass)); 230 } 231 232 require_once($classPath); 233 $this->maps[$class] = new $mapBuilderClass(); 234 $this->maps[$class]->doBuild(); 271 protected function loadMapBuilders() 272 { 273 $files = sfFinder::type('file')->name('*MapBuilder.php')->in(sfLoader::getModelDirs()); 274 foreach ($files as $file) 275 { 276 $mapBuilderClass = basename($file, '.php'); 277 $map = new $mapBuilderClass(); 278 $map->doBuild(); 235 279 } 236 280 } … … 257 301 } 258 302 303 $this->loadMapBuilders(); 259 304 $this->con = Propel::getConnection($connectionName); 305 $this->dbMap = Propel::getDatabaseMap($connectionName); 260 306 261 307 // get tables 262 308 if ('all' === $tables || is_null($tables)) 263 309 { 264 // load all map builder classes265 $files = sfFinder::type('file')->name('*MapBuilder.php')->in(sfLoader::getModelDirs());266 foreach ($files as $file)267 {268 $mapBuilderClass = basename($file, '.php');269 $map = new $mapBuilderClass();270 $map->doBuild();271 }272 273 $dbMap = Propel::getDatabaseMap($connectionName);274 310 $tables = array(); 275 foreach ($ dbMap->getTables() as $table)311 foreach ($this->dbMap->getTables() as $table) 276 312 { 277 313 $tables[] = $table->getPhpName(); … … 284 320 285 321 $dumpData = array(); 286 287 // load map classes288 array_walk($tables, array($this, 'loadMapBuilder'));289 322 290 323 $tables = $this->fixOrderingOfForeignKeyData($tables); 291 324 foreach ($tables as $tableName) 292 325 { 293 $tableMap = $this-> maps[$tableName]->getDatabaseMap()->getTable(constant($tableName.'Peer::TABLE_NAME'));326 $tableMap = $this->dbMap->getTable(constant($tableName.'Peer::TABLE_NAME')); 294 327 $hasParent = false; 295 328 $haveParents = false; … … 300 333 if ($column->isForeignKey()) 301 334 { 302 $relatedTable = $this-> maps[$tableName]->getDatabaseMap()->getTable($column->getRelatedTableName());335 $relatedTable = $this->dbMap->getTable($column->getRelatedTableName()); 303 336 if ($tableName === $relatedTable->getPhpName()) 304 337 { … … 365 398 if ($column->isForeignKey()) 366 399 { 367 $relatedTable = $this-> maps[$tableName]->getDatabaseMap()->getTable($column->getRelatedTableName());400 $relatedTable = $this->dbMap->getTable($column->getRelatedTableName()); 368 401 if ($isPrimaryKey) 369 402 { … … 424 457 { 425 458 $class = $classes[$i]; 426 $tableMap = $this-> maps[$class]->getDatabaseMap()->getTable(constant($class.'Peer::TABLE_NAME'));459 $tableMap = $this->dbMap->getTable(constant($class.'Peer::TABLE_NAME')); 427 460 foreach ($tableMap->getColumns() as $column) 428 461 { 429 462 if ($column->isForeignKey()) 430 463 { 431 $relatedTable = $this-> maps[$class]->getDatabaseMap()->getTable($column->getRelatedTableName());464 $relatedTable = $this->dbMap->getTable($column->getRelatedTableName()); 432 465 $relatedTablePos = array_search($relatedTable->getPhpName(), $classes); 433 466 trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelDatabaseSchema.class.php
r5820 r7131 12 12 * 13 13 * @package symfony 14 * @subpackage addon14 * @subpackage propel 15 15 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 16 16 * @author François Zaninotto <francois.zaninotto@symfony-project.com> trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelManyToMany.class.php
r1931 r7131 12 12 * 13 13 * @package symfony 14 * @subpackage util14 * @subpackage propel 15 15 * @author Nick Lane <nick.lane@internode.on.net> 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelPager.class.php
r6467 r7131 10 10 11 11 /** 12 * @package symfony13 * @subpackage addon14 * @author Fabien Potencier <fabien.potencier@symfony-project.com>15 * @version SVN: $Id$16 */17 18 /**19 12 * 20 13 * sfPropelPager class. 21 14 * 22 15 * @package symfony 23 * @subpackage addon16 * @subpackage propel 24 17 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 25 18 * @version SVN: $Id$ trunk/lib/plugins/sfPropelPlugin/lib/task/sfPropelBaseTask.class.php
r6174 r7131 212 212 } 213 213 214 /** 215 * @package symfony 216 * @subpackage command 217 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 218 * @version SVN: $Id$ 219 */ 214 220 class sfPhing extends Phing 215 221 { trunk/lib/plugins/sfPropelPlugin/lib/task/sfPropelGenerateCrudTask.class.php
r6097 r7131 32 32 $this->addOptions(array( 33 33 new sfCommandOption('theme', null, sfCommandOption::PARAMETER_REQUIRED, 'The theme name', 'default'), 34 new sfCommandOption('generate-in-cache', null, sfCommandOption::PARAMETER_NONE, 'Generate the module in cache'), 35 new sfCommandOption('non-atomic-actions', null, sfCommandOption::PARAMETER_NONE, 'Generate non atomic actions'), 36 new sfCommandOption('non-verbose-templates', null, sfCommandOption::PARAMETER_NONE, 'Generate non verbose templates'), 37 new sfCommandOption('with-show', null, sfCommandOption::PARAMETER_NONE, 'Generate a show method'), 38 new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), 34 39 )); 35 40 … … 46 51 The task creates a [%module%|COMMENT] module in the [%application%|COMMENT] application 47 52 for the model class [%model%|COMMENT]. 53 54 You can also create an empty module that inherits its actions and templates from 55 a runtime generated module in [%sf_app_cache_dir%/modules/auto%module%|COMMENT] by 56 using the [--generate-in-cache|COMMENT] option: 57 58 [./symfony propel:generate-crud --generate-in-cache frontend article Article|INFO] 48 59 49 60 The generator can use a customized theme by using the [--theme|COMMENT] option: … … 62 73 $properties = parse_ini_file(sfConfig::get('sf_config_dir').'/properties.ini', true); 63 74 64 // generate module 65 $tmpDir = sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.md5(uniqid(rand(), true)); 66 sfConfig::set('sf_module_cache_dir', $tmpDir); 67 $generatorManager = new sfGeneratorManager(); 68 $generatorManager->generate('sfPropelCrudGenerator', array('model_class' => $arguments['model'], 'moduleName' => $arguments['module'], 'theme' => $options['theme'])); 69 70 $moduleDir = sfConfig::get('sf_root_dir').'/'.sfConfig::get('sf_apps_dir_name').'/'.$arguments['application'].'/'.sfConfig::get('sf_app_module_dir_name').'/'.$arguments['module']; 71 72 // copy our generated module 73 $this->filesystem->mirror($tmpDir.'/auto'.ucfirst($arguments['module']), $moduleDir, sfFinder::type('any')); 74 75 // change module name 76 $this->filesystem->replaceTokens($moduleDir.'/actions/actions.class.php', '', '', array('auto'.ucfirst($arguments['module']) => $arguments['module'])); 77 78 $constants = array( 75 $this->constants = array( 79 76 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', 80 77 'APP_NAME' => $arguments['application'], … … 84 81 ); 85 82 83 $method = $options['generate-in-cache'] ? 'executeInit' : 'executeGenerate'; 84 85 $this->$method($arguments, $options); 86 } 87 88 protected function executeGenerate($arguments = array(), $options = array()) 89 { 90 $this->bootstrapSymfony($arguments['application'], $options['env'], true); 91 92 sfSimpleAutoload::getInstance()->unregister(); 93 sfSimpleAutoload::getInstance()->register(); 94 95 $databaseManager = new sfDatabaseManager(); 96 97 // generate module 98 $tmpDir = sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.md5(uniqid(rand(), true)); 99 sfConfig::set('sf_module_cache_dir', $tmpDir); 100 $generatorManager = new sfGeneratorManager(); 101 $generatorManager->generate('sfPropelCrudGenerator', array( 102 'model_class' => $arguments['model'], 103 'moduleName' => $arguments['module'], 104 'theme' => $options['theme'], 105 'non_atomic_actions' => $options['non-atomic-actions'], 106 'non_verbose_templates' => $options['non-verbose-templates'], 107 'with_show' => $options['with-show'], 108 )); 109 110 $moduleDir = sfConfig::get('sf_root_dir').'/'.sfConfig::get('sf_apps_dir_name').'/'.$arguments['application'].'/'.sfConfig::get('sf_app_module_dir_name').'/'.$arguments['module']; 111 112 // copy our generated module 113 $this->filesystem->mirror($tmpDir.'/auto'.ucfirst($arguments['module']), $moduleDir, sfFinder::type('any')); 114 115 if (!$options['with-show']) 116 { 117 $this->filesystem->remove($moduleDir.'/templates/showSuccess.php'); 118 } 119 120 // change module name 121 $this->filesystem->replaceTokens($moduleDir.'/actions/actions.class.php', '', '', array('auto'.ucfirst($arguments['module']) => $arguments['module'])); 122 86 123 // customize php and yml files 87 124 $finder = sfFinder::type('file')->name('*.php', '*.yml'); 88 $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $ constants);125 $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 89 126 90 127 // create basic test … … 92 129 93 130 // customize test file 94 $this->filesystem->replaceTokens(sfConfig::get('sf_root_dir').'/test/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $ constants);131 $this->filesystem->replaceTokens(sfConfig::get('sf_root_dir').'/test/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 95 132 96 133 // delete temp files 97 134 $this->filesystem->remove(sfFinder::type('any')->in($tmpDir)); 98 135 } 136 137 protected function executeInit($arguments = array(), $options = array()) 138 { 139 $moduleDir = sfConfig::get('sf_root_dir').'/'.sfConfig::get('sf_apps_dir_name').'/'.$arguments['application'].'/'.sfConfig::get('sf_app_module_dir_name').'/'.$arguments['module']; 140 141 // create basic application structure 142 $finder = sfFinder::type('any')->ignore_version_control()->discard('.sf'); 143 $dirs = sfLoader::getGeneratorSkeletonDirs('sfPropelCrud', $options['theme']); 144 foreach ($dirs as $dir) 145 { 146 if (is_dir($dir)) 147 { 148 $this->filesystem->mirror($dir, $moduleDir, $finder); 149 break; 150 } 151 } 152 153 // create basic test 154 $this->filesystem->copy(sfConfig::get('sf_symfony_data_dir').'/skeleton/module/test/actionsTest.php', sfConfig::get('sf_root_dir').'/test/functional/'.$arguments['application'].'/'.$arguments['module'].'ActionsTest.php'); 155 156 // customize test file 157 $this->filesystem->replaceTokens(sfConfig::get('sf_root_dir').'/test/functional/'.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); 158 159 // customize php and yml files 160 $finder = sfFinder::type('file')->name('*.php', '*.yml'); 161 $this->constants['CONFIG'] = sprintf(" non_atomic_actions: %s\n non_verbose_templates: %s\n with_show: %s", 162 $options['non-atomic-actions'] ? 'true' : 'false', 163 $options['non-verbose-templates'] ? 'true' : 'false', 164 $options['with-show'] ? 'true' : 'false' 165 ); 166 $this->filesystem->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); 167 } 99 168 } trunk/lib/plugins/sfPropelPlugin/test/functional/browseTest.php
r6522 r7131 66 66 67 67 // first line 68 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td ', '1', array('position' => 0))->69 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td ', 'foo title', array('position' => 1))->70 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td ', 'bar body', array('position' => 2))->71 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td img', true, array('position' => 3))->72 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td ', '1', array('position' => 4))->68 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(0)', '1')-> 69 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(1)', 'foo title')-> 70 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(2)', 'bar body')-> 71 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(3) img', true)-> 72 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td:nth(4)', '1')-> 73 73 checkResponseElement('body table tbody tr[class="sf_admin_row_0"] td a[href$="/article/edit/id/1"]', '1')-> // clickable 74 74 75 75 // second line 76 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td ', '2', array('position' => 0))->77 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td ', 'foo foo title', array('position' => 1))->78 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td ', 'bar bar body', array('position' => 2))->79 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td img', false, array('position' => 3))->80 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td ', '2', array('position' => 4))->76 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(0)', '2')-> 77 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(1)', 'foo foo title')-> 78 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(2)', 'bar bar body')-> 79 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(3) img', false)-> 80 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(4)', '2')-> 81 81 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td a[href$="/article/edit/id/2"]', '2')-> 82 82 … … 158 158 checkResponseElement('body form#sf_admin_edit_form input[name="article[online]"][id="article_online"][type="checkbox"][checked="checked"]', true)-> 159 159 checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"]', true)-> 160 checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"] option[value="1"]', ' 1')->161 checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"] option[value="2"]', ' 2')->160 checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"] option[value="1"]', 'Category 1')-> 161 checkResponseElement('body form#sf_admin_edit_form select[name="article[category_id]"][id="article_category_id"] option[value="2"]', 'Category 2')-> 162 162 checkResponseElement('body form#sf_admin_edit_form input[name="article[created_at]"][id="article_created_at"][value*="-"]')-> 163 163 … … 187 187 checkResponseElement('#article_body', 'my body')-> 188 188 checkResponseElement('input[id="article_online"][checked="checked"]', true)-> 189 checkResponseElement('#article_category_id option[selected="selected"]', ' 2')189 checkResponseElement('#article_category_id option[selected="selected"]', 'Category 2') 190 190 ; 191 191 … … 229 229 checkResponseElement('input[id="article_title"][value="new title"]')-> 230 230 checkResponseElement('#article_body', 'new body')-> 231 checkResponseElement('#article_category_id option[selected="selected"]', ' 2')->231 checkResponseElement('#article_category_id option[selected="selected"]', 'Category 2')-> 232 232 233 233 // check list 234 234 getAndCheck('article', 'list')-> 235 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td ', '', array('position' => 7))->235 checkResponseElement('body table tbody tr[class="sf_admin_row_1"] td:nth(7)', '')-> 236 236 237 237 // nb lines trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/config/schema.xml
r5103 r7131 4 4 <table name="article"> 5 5 <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" /> 6 <column name="title" type="varchar" size="255" />6 <column name="title" type="varchar" size="255" required="true" /> 7 7 <column name="body" type="longvarchar" /> 8 8 <column name="online" type="boolean" /> trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/Book.php
r5103 r7131 10 10 class Book extends BaseBook 11 11 { 12 public function __toString() 13 { 14 return $this->getName(); 15 } 12 16 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/Category.php
r5103 r7131 10 10 class Category extends BaseCategory 11 11 { 12 public function __toString() 13 { 14 return $this->getName(); 15 } 12 16 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/map/ArticleMapBuilder.php
r5103 r7131 35 35 $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); 36 36 37 $tMap->addColumn('TITLE', 'Title', 'string', CreoleTypes::VARCHAR, false, 255);37 $tMap->addColumn('TITLE', 'Title', 'string', CreoleTypes::VARCHAR, true, 255); 38 38 39 39 $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false, null); trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseArticle.php
r5103 r7131 676 676 public function getCategory($con = null) 677 677 { 678 include_once 'lib/model/om/BaseCategoryPeer.php';679 680 678 if ($this->aCategory === null && ($this->category_id !== null)) { 681 682 $this->aCategory = CategoryPeer::retrieveByPK($this->category_id, $con); 679 $this->aCategory = CategoryPeer::retrieveByPK($this->category_id, $con); 683 680 684 681 … … 706 703 public function getBook($con = null) 707 704 { 708 include_once 'lib/model/om/BaseBookPeer.php';709 710 705 if ($this->aBook === null && ($this->book_id !== null)) { 711 712 $this->aBook = BookPeer::retrieveByPK($this->book_id, $con); 706 $this->aBook = BookPeer::retrieveByPK($this->book_id, $con); 713 707 714 708 … … 728 722 public function getAuthorArticles($criteria = null, $con = null) 729 723 { 730 include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 731 if ($criteria === null) { 724 if ($criteria === null) { 732 725 $criteria = new Criteria(); 733 726 } … … 766 759 public function countAuthorArticles($criteria = null, $distinct = false, $con = null) 767 760 { 768 include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 769 if ($criteria === null) { 761 if ($criteria === null) { 770 762 $criteria = new Criteria(); 771 763 } … … 791 783 public function getAuthorArticlesJoinAuthor($criteria = null, $con = null) 792 784 { 793 include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 794 if ($criteria === null) { 785 if ($criteria === null) { 795 786 $criteria = new Criteria(); 796 787 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseArticlePeer.php
r5103 r7131 67 67 public static function getMapBuilder() 68 68 { 69 include_once 'lib/model/map/ArticleMapBuilder.php';70 69 return BasePeer::getMapBuilder('lib.model.map.ArticleMapBuilder'); 71 70 } … … 830 829 } 831 830 } else { 832 require_once 'lib/model/map/ArticleMapBuilder.php'; 833 Propel::registerMapBuilder('lib.model.map.ArticleMapBuilder'); 831 Propel::registerMapBuilder('lib.model.map.ArticleMapBuilder'); 834 832 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthor.php
r5103 r7131 359 359 public function getAuthorArticles($criteria = null, $con = null) 360 360 { 361 include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 362 if ($criteria === null) { 361 if ($criteria === null) { 363 362 $criteria = new Criteria(); 364 363 } … … 397 396 public function countAuthorArticles($criteria = null, $distinct = false, $con = null) 398 397 { 399 include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 400 if ($criteria === null) { 398 if ($criteria === null) { 401 399 $criteria = new Criteria(); 402 400 } … … 422 420 public function getAuthorArticlesJoinArticle($criteria = null, $con = null) 423 421 { 424 include_once 'lib/model/om/BaseAuthorArticlePeer.php'; 425 if ($criteria === null) { 422 if ($criteria === null) { 426 423 $criteria = new Criteria(); 427 424 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthorArticle.php
r5103 r7131 418 418 public function getAuthor($con = null) 419 419 { 420 include_once 'lib/model/om/BaseAuthorPeer.php';421 422 420 if ($this->aAuthor === null && ($this->author_id !== null)) { 423 424 $this->aAuthor = AuthorPeer::retrieveByPK($this->author_id, $con); 421 $this->aAuthor = AuthorPeer::retrieveByPK($this->author_id, $con); 425 422 426 423 … … 448 445 public function getArticle($con = null) 449 446 { 450 include_once 'lib/model/om/BaseArticlePeer.php';451 452 447 if ($this->aArticle === null && ($this->article_id !== null)) { 453 454 $this->aArticle = ArticlePeer::retrieveByPK($this->article_id, $con); 448 $this->aArticle = ArticlePeer::retrieveByPK($this->article_id, $con); 455 449 456 450 trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthorArticlePeer.php
r5103 r7131 52 52 public static function getMapBuilder() 53 53 { 54 include_once 'lib/model/map/AuthorArticleMapBuilder.php';55 54 return BasePeer::getMapBuilder('lib.model.map.AuthorArticleMapBuilder'); 56 55 } … … 805 804 } 806 805 } else { 807 require_once 'lib/model/map/AuthorArticleMapBuilder.php'; 808 Propel::registerMapBuilder('lib.model.map.AuthorArticleMapBuilder'); 806 Propel::registerMapBuilder('lib.model.map.AuthorArticleMapBuilder'); 809 807 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseAuthorPeer.php
r5103 r7131 49 49 public static function getMapBuilder() 50 50 { 51 include_once 'lib/model/map/AuthorMapBuilder.php';52 51 return BasePeer::getMapBuilder('lib.model.map.AuthorMapBuilder'); 53 52 } … … 364 363 } 365 364 } else { 366 require_once 'lib/model/map/AuthorMapBuilder.php'; 367 Propel::registerMapBuilder('lib.model.map.AuthorMapBuilder'); 365 Propel::registerMapBuilder('lib.model.map.AuthorMapBuilder'); 368 366 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseBook.php
r5103 r7131 359 359 public function getArticles($criteria = null, $con = null) 360 360 { 361 include_once 'lib/model/om/BaseArticlePeer.php'; 362 if ($criteria === null) { 361 if ($criteria === null) { 363 362 $criteria = new Criteria(); 364 363 } … … 397 396 public function countArticles($criteria = null, $distinct = false, $con = null) 398 397 { 399 include_once 'lib/model/om/BaseArticlePeer.php'; 400 if ($criteria === null) { 398 if ($criteria === null) { 401 399 $criteria = new Criteria(); 402 400 } … … 422 420 public function getArticlesJoinCategory($criteria = null, $con = null) 423 421 { 424 include_once 'lib/model/om/BaseArticlePeer.php'; 425 if ($criteria === null) { 422 if ($criteria === null) { 426 423 $criteria = new Criteria(); 427 424 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseBookPeer.php
r5103 r7131 49 49 public static function getMapBuilder() 50 50 { 51 include_once 'lib/model/map/BookMapBuilder.php';52 51 return BasePeer::getMapBuilder('lib.model.map.BookMapBuilder'); 53 52 } … … 364 363 } 365 364 } else { 366 require_once 'lib/model/map/BookMapBuilder.php'; 367 Propel::registerMapBuilder('lib.model.map.BookMapBuilder'); 365 Propel::registerMapBuilder('lib.model.map.BookMapBuilder'); 368 366 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseCategory.php
r5103 r7131 359 359 public function getArticles($criteria = null, $con = null) 360 360 { 361 include_once 'lib/model/om/BaseArticlePeer.php'; 362 if ($criteria === null) { 361 if ($criteria === null) { 363 362 $criteria = new Criteria(); 364 363 } … … 397 396 public function countArticles($criteria = null, $distinct = false, $con = null) 398 397 { 399 include_once 'lib/model/om/BaseArticlePeer.php'; 400 if ($criteria === null) { 398 if ($criteria === null) { 401 399 $criteria = new Criteria(); 402 400 } … … 422 420 public function getArticlesJoinBook($criteria = null, $con = null) 423 421 { 424 include_once 'lib/model/om/BaseArticlePeer.php'; 425 if ($criteria === null) { 422 if ($criteria === null) { 426 423 $criteria = new Criteria(); 427 424 } trunk/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/model/om/BaseCategoryPeer.php
r5103 r7131 49 49 public static function getMapBuilder() 50 50 { 51 include_once 'lib/model/map/CategoryMapBuilder.php';52 51 return BasePeer::getMapBuilder('lib.model.map.CategoryMapBuilder'); 53 52 } … … 364 363 } 365 364 } else { 366 require_once 'lib/model/map/CategoryMapBuilder.php'; 367 Propel::registerMapBuilder('lib.model.map.CategoryMapBuilder'); 365 Propel::registerMapBuilder('lib.model.map.CategoryMapBuilder'); 368 366 } trunk/lib/request/sfWebRequest.class.php
r6779 r7131 899 899 } 900 900 901 /** 902 * Parses the request parameters. 903 * 904 * This method notifies the request.filter_parameters event. 905 * 906 * @return array An array of request parameters. 907 */ 901 908 protected function parseRequestParameters() 902 909 { 903 910 $parameters = array(); 904 905 try 906 { 907 $parameters = $this->dispatcher->filter(new sfEvent($this, 'request.filter_parameters', array('path_info' => $this->getPathInfo())), $parameters)->getReturnValue(); 908 } 909 catch (sfError404Exception $e) 910 { 911 $parameters['module'] = sfConfig::get('sf_error_404_module', 'default'); 912 $parameters['action'] = sfConfig::get('sf_error_404_action', 'error404'); 913 } 911 $parameters = $this->dispatcher->filter(new sfEvent($this, 'request.filter_parameters', array('path_info' => $this->getPathInfo())), $parameters)->getReturnValue(); 914 912 915 913 if (!isset($parameters['module'])) … … 923 921 } 924 922 925 $this->requestParameters = $parameters; 923 if (empty($parameters['module']) || empty($parameters['action'])) 924 { 925 throw new sfError404Exception(sprintf('Empty module and/or action after parsing the URL "%s" (%s/%s).', $this->getPathInfo(), $parameters['module'], $parameters['action'])); 926 } 927 928 return $parameters; 926 929 } 927 930 … … 937 940 938 941 // additional parameters 939 $this-> parseRequestParameters();942 $this->requestParameters = $this->parseRequestParameters(); 940 943 $this->parameterHolder->add($this->requestParameters); 941 944 trunk/lib/response/sfWebResponse.class.php
r6779 r7131 246 246 public function setContentType($value) 247 247 { 248 // add charset if needed 249 if (false === stripos($value, 'charset') && 0 === stripos($value, 'text/'))248 // add charset if needed (only on text content) 249 if (false === stripos($value, 'charset') && (0 === stripos($value, 'text/') || strlen($value) - 3 === strripos($value, 'xml'))) 250 250 { 251 251 $value .= '; charset='.$this->getParameter('charset'); trunk/lib/routing/sfNoRouting.class.php
r6779 r7131 38 38 unset($parameters['module'], $parameters['action']); 39 39 ksort($parameters); 40 $parameters = count($parameters) ? '?'.http_build_query($parameters ) : '';40 $parameters = count($parameters) ? '?'.http_build_query($parameters, null, '&') : ''; 41 41 42 42 return sprintf('%s/%s%s', $module, $action, $parameters); … … 54 54 public function generate($name, $params, $querydiv = '/', $divider = '/', $equals = '/') 55 55 { 56 $parameters = http_build_query(array_merge($this->defaultParameters, $params) );56 $parameters = http_build_query(array_merge($this->defaultParameters, $params), null, '&'); 57 57 58 58 return '/'.($parameters ? '?'.$parameters : ''); trunk/lib/routing/sfPathInfoRouting.class.php
r6779 r7131 39 39 unset($parameters['module'], $parameters['action']); 40 40 ksort($parameters); 41 $parameters = count($parameters) ? '?'.http_build_query($parameters ) : '';41 $parameters = count($parameters) ? '?'.http_build_query($parameters, null, '&') : ''; 42 42 43 43 return sprintf('%s/%s%s', $module, $action, $parameters); trunk/lib/routing/sfPatternRouting.class.php
r6779 r7131 601 601 $this->currentRouteParameters = null; 602 602 603 throw new sfError404Exception( 'No matching route found');603 throw new sfError404Exception(sprintf('No matching route found for "%s"', $url)); 604 604 } 605 605 trunk/lib/task/cache/sfCacheClearTask.class.php
r5260 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/generator/sfGenerateAppTask.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/generator/sfGenerateControllerTask.class.php
r6097 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/generator/sfGenerateModuleTask.class.php
r6097 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/generator/sfGenerateProjectTask.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/generator/sfGeneratorBaseTask.class.php
r4743 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/help/sfCommandApplicationTask.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/help/sfHelpTask.class.php
r5250 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/help/sfListTask.class.php
r5250 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/i18n/sfI18nExtractTask.class.php
r5232 r7131 19 19 * 20 20 * @package symfony 21 * @subpackage command21 * @subpackage task 22 22 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 23 23 * @version SVN: $Id$ trunk/lib/task/i18n/sfI18nFindTask.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/log/sfLogClearTask.class.php
r4841 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/log/sfLogRotateTask.class.php
r4886 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/plugin/sfPluginAddChannelTask.class.php
r5457 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/plugin/sfPluginBaseTask.class.php
r5260 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/plugin/sfPluginInstallTask.class.php
r5361 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/plugin/sfPluginListTask.class.php
r5361 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/plugin/sfPluginUninstallTask.class.php
r5361 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/plugin/sfPluginUpgradeTask.class.php
r5361 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/sfProjectClearControllersTask.class.php
r4743 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/sfProjectDeployTask.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/sfProjectDisableTask.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/sfProjectEnableTask.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/sfProjectFreezeTask.class.php
r6779 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/sfProjectPermissionsTask.class.php
r5083 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/sfProjectUnfreezeTask.class.php
r6779 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/sfUpgradeTo11Task.class.php
r5269 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfAutoloadingUpgrade.class.php
r6507 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfComponentUpgrade.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfEnvironmentUpgrade.class.php
r5260 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfFactoriesUpgrade.class.php
r6373 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfFlashUpgrade.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfLoggerUpgrade.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfPropelUpgrade.class.php
r6336 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfSingletonUpgrade.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfUpgrade.class.php
r5269 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/project/upgrade1.1/sfWebDebugUpgrade.class.php
r6509 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/sfBaseTask.class.php
r5236 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ … … 67 67 public function bootstrapSymfony($app, $env = 'dev', $debug = true) 68 68 { 69 if (defined('SF_ROOT_DIR')) 70 { 71 return; 72 } 73 69 74 define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); 70 75 define('SF_APP', $app); trunk/lib/task/sfTask.class.php
r5232 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ … … 86 86 $commandManager = new sfCommandManager(new sfCommandArgumentSet($this->getArguments()), new sfCommandOptionSet($this->getOptions())); 87 87 88 return $this->doRun($commandManager, array_merge($arguments, $options)); 88 // add -- before each option if needed 89 foreach ($options as &$option) 90 { 91 if (0 !== strpos($option, '--')) 92 { 93 $option = '--'.$option; 94 } 95 } 96 97 return $this->doRun($commandManager, implode(' ', array_merge($arguments, $options))); 89 98 } 90 99 trunk/lib/task/test/sfTestAllTask.class.php
r4743 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/test/sfTestFunctionalTask.class.php
r4743 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/task/test/sfTestUnitTask.class.php
r4743 r7131 13 13 * 14 14 * @package symfony 15 * @subpackage command15 * @subpackage task 16 16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 17 * @version SVN: $Id$ trunk/lib/user/sfUser.class.php
r6779 r7131 88 88 // otherwise 89 89 // - use the culture defined in the user session 90 // - use the default culture set in i18n.yml90 // - use the default culture set in settings.yml 91 91 $currentCulture = $storage->read(self::CULTURE_NAMESPACE); 92 92 $this->setCulture($this->getParameter('culture', !is_null($currentCulture) ? $currentCulture : $this->getParameter('default_culture', 'en'))); trunk/lib/util/sfAutoload.class.php
r5384 r7131 16 16 * 17 17 * @package symfony 18 * @subpackage util 18 19 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 19 20 * @version SVN: $Id$ … … 28 29 $classes = array(); 29 30 30 protected function __construct() 31 { 32 } 33 31 /** 32 * Retrieves the singleton instance of this class. 33 * 34 * @return sfAutoload A sfAutoload implementation instance. 35 */ 34 36 static public function getInstance() 35 37 { … … 42 44 } 43 45 46 /** 47 * Register sfAutoload in spl autoloader. 48 * 49 * @return void 50 */ 44 51 public function register() 45 52 { … … 49 56 } 50 57 58 /** 59 * Unregister sfAutoload from spl autoloader. 60 * 61 * @return void 62 */ 51 63 public function unregister() 52 64 { … … 54 66 } 55 67 68 /** 69 * Sets path to class. 70 * 71 * @param string A class name. 72 * @param string Path to class. 73 * 74 * @return void 75 */ 56 76 public function setClassPath($class, $path) 57 77 { … … 61 81 } 62 82 83 /** 84 * Get path to class. 85 * 86 * @param string A class name. 87 * 88 * @return void 89 */ 63 90 public function getClassPath($class) 64 91 { … … 66 93 } 67 94 95 /** 96 * Reloads all registered classes. 97 * 98 * @param boolean Force delete of autoload cache? 99 * 100 * @return void 101 */ 68 102 public function reloadClasses($force = false) 69 103 { … … 106 140 } 107 141 108 function autoloadAgain($class) 142 /** 143 * Reloads a class. 144 * 145 * @param string A class name. 146 * 147 * @return boolean Returns true if the class has been loaded 148 */ 149 public function autoloadAgain($class) 109 150 { 110 151 self::reloadClasses(true); trunk/lib/util/sfBrowser.class.php
r6779 r7131 33 33 $currentException = null; 34 34 35 /** 36 * Class constructor. 37 * 38 * @param string Hostname to browse 39 * @param string Remote address to spook 40 * @param array Options for sfBrowser 41 * 42 * @return void 43 */ 35 44 public function __construct($hostname = null, $remote = null, $options = array()) 36 45 { … … 38 47 } 39 48 49 /** 50 * Initializes sfBrowser - sets up environment 51 * 52 * @param string Hostname to browse 53 * @param string Remote address to spook 54 * @param array Options for sfBrowser 55 * 56 * @return void 57 */ 40 58 public function initialize($hostname = null, $remote = null, $options = array()) 41 59 { … … 60 78 } 61 79 80 /** 81 * Sets variable name 82 * 83 * @param string The variable name 84 * @param mixed The value 85 * 86 * @return sfBrowser 87 */ 62 88 public function setVar($name, $value) 63 89 { … … 67 93 } 68 94 69 public function setAuth($login, $password) 70 { 71 $this->vars['PHP_AUTH_USER'] = $login; 95 /** 96 * Sets username and password for simulating http authentication. 97 * 98 * @param string The username 99 * @param string The password 100 * 101 * @return sfBrowser 102 */ 103 public function setAuth($username, $password) 104 { 105 $this->vars['PHP_AUTH_USER'] = $username; 72 106 $this->vars['PHP_AUTH_PW'] = $password; 73 107 … … 75 109 } 76 110 111 /** 112 * Gets a uri. 113 * 114 * @param string The URI to fetch 115 * @param array The Request parameters 116 * 117 * @return sfBrowser 118 */ 77 119 public function get($uri, $parameters = array()) 78 120 { … … 80 122 } 81 123 124 /** 125 * Posts a uri. 126 * 127 * @param string The URI to fetch 128 * @param array The Request parameters 129 * 130 * @return sfBrowser 131 */ 82 132 public function post($uri, $parameters = array()) 83 133 { … … 85 135 } 86 136 137 /** 138 * Calls a request to a uri. 139 * 140 * @param string The URI to fetch 141 * @param string The request method 142 * @param array The Request parameters 143 * @param boolean Change the browser history stack? 144 * 145 * @return sfBrowser 146 */ 87 147 public function call($uri, $method = 'get', $parameters = array(), $changeStack = true) 88 148 { … … 228 288 } 229 289 290 /** 291 * Go back in the browser history stack. 292 * 293 * @return sfBrowser 294 */ 230 295 public function back() 231 296 { … … 239 304 } 240 305 306 /**