From 623b78e939208931622c8d7c58475d77cf714ccc Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Tue, 31 Jul 2012 09:40:41 +0200 Subject: [PATCH] Vendors update Signed-off-by: Polonkai Gergely --- vendor/doctrine/dbal/run-all.sh | 0 .../DependencyInjection/Configuration.php | 2 + .../DependencyInjection/DoctrineExtension.php | 12 + .../DoctrineBundle/Resources/config/orm.xml | 8 + .../Resources/config/schema/doctrine-1.0.xsd | 2 + .../Resources/doc/configuration.rst | 7 +- .../Resources/views/Collector/db.html.twig | 2 +- .../AbstractDoctrineExtensionTest.php | 37 ++ .../config/xml/dbal_schema_filter.xml | 12 + .../config/xml/orm_namingstrategy.xml | 23 ++ .../config/yml/dbal_schema_filter.yml | 3 + .../config/yml/orm_namingstrategy.yml | 18 + .../DependencyInjection/XMLSchemaTest.php | 13 +- vendor/doctrine/migrations | 2 +- .../ORM/Mapping/Driver/AnnotationDriver.php | 15 +- .../lib/Doctrine/ORM/PersistentCollection.php | 2 +- .../ORM/Persisters/ManyToManyPersister.php | 2 +- .../lib/Doctrine/ORM/Proxy/ProxyFactory.php | 1 - .../doctrine/orm/lib/Doctrine/ORM/Query.php | 3 +- .../lib/Doctrine/ORM/Query/QueryException.php | 4 +- .../Doctrine/ORM/Tools/EntityGenerator.php | 6 +- .../Export/Driver/AnnotationExporter.php | 3 +- .../doctrine/orm/lib/Doctrine/ORM/Version.php | 2 +- .../Models/Navigation/NavPointOfInterest.php | 23 ++ .../Tests/Models/Navigation/NavUser.php | 28 ++ .../Functional/CompositePrimaryKeyTest.php | 23 ++ .../Doctrine/Tests/OrmFunctionalTestCase.php | 1 + .../Asset/AssetCollectionInterface.php | 2 +- .../assetic/src/Assetic/Asset/FileAsset.php | 2 +- .../assetic/src/Assetic/Asset/HttpAsset.php | 2 +- .../assetic/src/Assetic/AssetManager.php | 2 +- .../Assetic/Extension/Twig/AsseticNode.php | 2 +- .../src/Assetic/Factory/LazyAssetManager.php | 4 +- .../assetic/src/Assetic/FilterManager.php | 2 +- .../DistributionBundle/Resources/bin/build.sh | 0 .../Resources/bin/build_bootstrap.php | 0 .../Configuration/ParamConverter.php | 27 ++ .../Compiler/AddParamConverterPass.php | 14 +- .../EventListener/ControllerListener.php | 30 +- .../EventListener/ParamConverterListener.php | 4 +- .../ParamConverter/DateTimeParamConverter.php | 59 +++ .../ParamConverter/DoctrineParamConverter.php | 76 +++- .../ParamConverter/ParamConverterManager.php | 84 +++- .../Resources/config/converters.xml | 7 +- .../Resources/doc/annotations/converters.rst | 94 ++++- .../Resources/doc/annotations/view.rst | 13 + .../AnnotatedRouteControllerLoader.php | 3 +- .../Templating/TemplateGuesser.php | 10 +- .../EventListener/ControllerListenerTest.php | 19 + .../FooControllerCacheAtClassAndMethod.php | 9 + .../ParamConverterListenerTest.php | 34 ++ .../DateTimeParamConverterTest.php | 69 ++++ .../DoctrineParamConverterTest.php | 93 ++++- .../ParamConverterManagerTest.php | 67 ++++ .../Bundle/FrameworkExtraBundle/UPGRADE.md | 50 +++ .../Bundle/FrameworkExtraBundle/composer.json | 3 +- .../Command/GenerateBundleCommand.php | 2 +- .../images/simpletest-contribute.png | Bin .../simpletest.org/js/jquery.heartbeat.js | 0 .../simpletest.org/js/jquery.sparkline.js | 0 .../docs/simpletest.org/views/heartbeat.php | 0 .../simpletest/docs/source/en/changelog.xml | 0 .../simpletest/docs/source/en/heartbeat.xml | 0 .../extensions/recorder/test/sample.php | 0 .../extensions/recorder/test/test.php | 0 .../lib/simpletest/packages/build_tarball.sh | 0 .../simpletest/packages/make_bundled_docs.sh | 0 .../packages/make_bundled_docs_with_xalan.sh | 0 .../packages/make_lastcraft_docs.sh | 0 .../simpletest/packages/make_phpdoc_docs.sh | 0 .../packages/pear_package_create.php | 0 .../lib/simpletest/packages/simpletest.ini | 0 .../packages/simpletest.org/integration.php | 0 .../test/package/en/synchronisation.xml | 0 .../test/package/fr/no-synchronisation.xml | 0 .../test/package/fr/synchronisation.xml | 0 .../test/package/one_section_changelogged.xml | 0 .../Resources/config/assetic.xml | 6 +- vendor/symfony/symfony/UPGRADE-2.1.md | 18 +- .../Form/ChoiceList/EntityChoiceList.php | 4 +- .../Form/ChoiceList/EntityChoiceListTest.php | 10 +- .../Tests/Form/Type/EntityTypeTest.php | 14 +- .../Constraints/UniqueValidatorTest.php | 1 + .../Form/ChoiceList/ModelChoiceList.php | 4 +- .../Form/ChoiceList/ModelChoiceListTest.php | 10 +- .../Twig/Node/SearchAndRenderBlockNode.php | 74 +++- .../views/Form/form_div_layout.html.twig | 2 +- .../views/Form/form_table_layout.html.twig | 2 +- .../Extension/FormExtensionDivLayoutTest.php | 2 +- .../Node/SearchAndRenderBlockNodeTest.php | 282 ++++++++++++++ .../Command/AssetsInstallCommand.php | 2 +- .../Compiler/RegisterKernelListenersPass.php | 2 +- .../Bundle/FrameworkBundle/HttpKernel.php | 8 +- .../FrameworkBundle/Resources/config/form.xml | 29 +- .../Resources/config/routing.xml | 6 +- .../Resources/views/Form/form_row.html.php | 2 +- .../views/FormTable/form_row.html.php | 2 +- .../Templating/Helper/FormHelper.php | 2 +- .../Component/BrowserKit/Tests/ClientTest.php | 19 + .../BrowserKit/Tests/CookieJarTest.php | 23 ++ .../Component/BrowserKit/Tests/CookieTest.php | 1 + .../Builder/ArrayNodeDefinitionTest.php | 2 +- .../Definition/Builder/ExprBuilderTest.php | 6 +- .../Definition/Builder/TreeBuilderTest.php | 4 +- .../Symfony/Component/Console/Application.php | 2 +- .../OutputFormatterStyleInterface.php | 2 +- .../Console/Tests/ApplicationTest.php | 6 +- .../Compiler/InlineServiceDefinitionsPass.php | 4 +- .../Component/Filesystem/Filesystem.php | 6 +- .../Filesystem/Tests/FilesystemTest.php | 34 +- .../Finder/Iterator/CustomFilterIterator.php | 2 +- .../Iterator/DateRangeFilterIterator.php | 2 +- .../Iterator/DepthRangeFilterIterator.php | 2 +- .../ExcludeDirectoryFilterIterator.php | 2 +- .../Iterator/FileTypeFilterIterator.php | 2 +- .../Finder/Iterator/FilterIterator.php | 42 ++ .../Iterator/MultiplePcreFilterIterator.php | 2 +- .../Iterator/SizeRangeFilterIterator.php | 2 +- .../Component/Finder/Tests/FinderTest.php | 19 + .../FilecontentFilterIteratorTest.php | 2 - .../Tests/Iterator/FilterIteratorTest.php | 50 +++ .../Component/Form/AbstractRendererEngine.php | 2 +- .../src/Symfony/Component/Form/CHANGELOG.md | 6 +- .../Extension/Core/ChoiceList/ChoiceList.php | 75 ++-- .../Core/ChoiceList/ObjectChoiceList.php | 31 +- .../Core/ChoiceList/SimpleChoiceList.php | 35 +- .../Form/Extension/Core/CoreExtension.php | 1 - .../Form/Extension/Core/Type/FormType.php | 63 +-- .../Form/Extension/Core/View/ChoiceView.php | 11 +- .../Csrf/Type/FormTypeCsrfExtension.php | 5 +- .../EventListener/BindRequestListener.php | 2 +- .../HttpFoundationExtension.php | 29 ++ .../Type/FormTypeHttpFoundationExtension.php | 50 +++ .../Validator/ValidatorTypeGuesser.php | 25 +- .../src/Symfony/Component/Form/Form.php | 64 +-- .../Symfony/Component/Form/FormBuilder.php | 21 +- .../Component/Form/FormBuilderInterface.php | 2 +- .../{FormConfig.php => FormConfigBuilder.php} | 149 ++++++- ...ace.php => FormConfigBuilderInterface.php} | 9 +- .../Symfony/Component/Form/FormFactory.php | 38 +- .../Symfony/Component/Form/FormRegistry.php | 49 +-- .../Component/Form/FormRegistryInterface.php | 16 +- .../Symfony/Component/Form/FormRenderer.php | 81 ++-- .../Component/Form/ImmutableFormConfig.php | 365 ------------------ .../Component/Form/ResolvedFormType.php | 53 ++- .../Form/ResolvedFormTypeFactory.php | 26 ++ .../Form/ResolvedFormTypeFactoryInterface.php | 38 ++ .../Form/ResolvedFormTypeInterface.php | 37 ++ .../Form/Tests/AbstractDivLayoutTest.php | 36 +- .../Form/Tests/AbstractLayoutTest.php | 27 +- .../Form/Tests/AbstractTableLayoutTest.php | 2 +- .../Component/Form/Tests/CompoundFormTest.php | 2 +- .../Core/ChoiceList/ChoiceListTest.php | 55 ++- .../Core/ChoiceList/LazyChoiceListTest.php | 4 +- .../Core/ChoiceList/ObjectChoiceListTest.php | 30 +- .../Core/ChoiceList/SimpleChoiceListTest.php | 12 +- .../DataMapper/PropertyPathMapperTest.php | 34 +- .../Extension/Core/Type/ChoiceTypeTest.php | 45 ++- .../Extension/Core/Type/CountryTypeTest.php | 10 +- .../Extension/Core/Type/DateTypeTest.php | 24 +- .../Extension/Core/Type/FormTypeTest.php | 16 +- .../Extension/Core/Type/LanguageTypeTest.php | 12 +- .../Extension/Core/Type/LocaleTypeTest.php | 6 +- .../Extension/Core/Type/RepeatedTypeTest.php | 2 +- .../Extension/Core/Type/TimeTypeTest.php | 12 +- .../Extension/Core/Type/TimezoneTypeTest.php | 4 +- .../EventListener/BindRequestListenerTest.php | 22 +- .../ViolationMapper/ViolationMapperTest.php | 4 +- .../Tests/Fixtures/AlternatingRowType.php | 27 ++ .../Component/Form/Tests/FormConfigTest.php | 4 +- .../Component/Form/Tests/FormFactoryTest.php | 28 +- .../Form/Tests/FormIntegrationTestCase.php | 11 +- .../Component/Form/Tests/FormRegistryTest.php | 148 ++++--- .../Form/Tests/ResolvedFormTypeTest.php | 2 +- .../Component/Form/Tests/SimpleFormTest.php | 34 +- .../Component/Form/Util/PropertyPath.php | 4 +- .../HttpFoundation/RedirectResponse.php | 53 ++- .../Component/HttpFoundation/Request.php | 2 +- .../HttpFoundation/RequestMatcher.php | 11 +- .../Component/HttpFoundation/Response.php | 5 +- .../Session/Storage/NativeSessionStorage.php | 2 +- .../Tests/RedirectResponseTest.php | 8 + .../Tests/RequestMatcherTest.php | 3 + .../DataCollector/RouterDataCollector.php | 2 +- .../HttpKernel/Debug/ExceptionHandler.php | 2 +- .../HttpKernel/Event/PostResponseEvent.php | 2 +- .../Component/HttpKernel/KernelEvents.php | 2 +- .../Profiler/FileProfilerStorage.php | 2 +- .../Profiler/RedisProfilerStorage.php | 2 +- .../Component/Locale/Stub/StubIntl.php | 2 + .../Component/OptionsResolver/LazyOption.php | 73 ---- .../Component/OptionsResolver/Options.php | 146 +++++-- .../OptionsResolver/OptionsResolver.php | 15 +- .../OptionsResolver/Tests/LazyOptionTest.php | 44 --- .../OptionsResolver/Tests/OptionsTest.php | 175 ++++++++- .../src/Symfony/Component/Process/Process.php | 8 +- .../Component/Process/Tests/ProcessTest.php | 2 +- .../Matcher/Dumper/PhpMatcherDumper.php | 2 +- .../Component/Routing/Matcher/UrlMatcher.php | 2 +- .../Component/Routing/RouteCollection.php | 2 +- .../Tests/Fixtures/dumper/url_matcher1.php | 8 +- .../Tests/Fixtures/dumper/url_matcher2.php | 8 +- .../Tests/Generator/UrlGeneratorTest.php | 2 +- .../Tests/Matcher/ApacheUrlMatcherTest.php | 12 + .../Matcher/Dumper/PhpMatcherDumperTest.php | 12 +- .../Routing/Tests/Matcher/UrlMatcherTest.php | 2 +- .../Routing/Tests/RouteCollectionTest.php | 6 +- .../Symfony/Component/Security/CHANGELOG.md | 4 +- .../Component/Security/Core/User/User.php | 1 + .../DefaultAuthenticationSuccessHandler.php | 2 +- .../Http/Event/InteractiveLoginEvent.php | 16 + .../Tests/Acl/Dbal/MutableAclProviderTest.php | 2 +- .../Security/Tests/Acl/Domain/AclTest.php | 2 +- .../Domain/PermissionGrantingStrategyTest.php | 2 +- .../Acl/Domain/UserSecurityIdentityTest.php | 2 +- .../Normalizer/SerializerAwareNormalizer.php | 3 + .../Tests/Dumper/CsvFileDumperTest.php | 2 +- .../Tests/Dumper/IcuResFileDumperTest.php | 2 +- .../Tests/Dumper/IniFileDumperTest.php | 2 +- .../Tests/Dumper/MoFileDumperTest.php | 2 +- .../Tests/Dumper/PhpFileDumperTest.php | 2 +- .../Tests/Dumper/PoFileDumperTest.php | 2 +- .../Tests/Dumper/QtFileDumperTest.php | 2 +- .../Tests/Dumper/XliffFileDumperTest.php | 2 +- .../Tests/Dumper/YamlFileDumperTest.php | 2 +- .../Tests/PluralizationRulesTest.php | 2 +- .../Translation/Writer/TranslationWriter.php | 2 +- .../Symfony/Component/Validator/CHANGELOG.md | 2 +- .../Component/Validator/Constraints/Size.php | 32 -- .../Validator/Constraints/SizeValidator.php | 26 -- .../Tests/Constraints/LengthValidatorTest.php | 12 +- .../Constraints/MaxLengthValidatorTest.php | 4 +- .../Constraints/MinLengthValidatorTest.php | 4 +- .../Twig/Tests/Fixtures/filters/merge.test | 4 +- 234 files changed, 3120 insertions(+), 1292 deletions(-) mode change 100755 => 100644 vendor/doctrine/dbal/run-all.sh create mode 100644 vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/dbal_schema_filter.xml create mode 100644 vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_namingstrategy.xml create mode 100644 vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/dbal_schema_filter.yml create mode 100644 vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_namingstrategy.yml create mode 100644 vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavUser.php mode change 100755 => 100644 vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build.sh mode change 100755 => 100644 vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DateTimeParamConverter.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ParamConverterListenerTest.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/DateTimeParamConverterTest.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/UPGRADE.md mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-contribute.png mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.heartbeat.js mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.sparkline.js mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/heartbeat.php mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/changelog.xml mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/heartbeat.xml mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/sample.php mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/test.php mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/build_tarball.sh mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs.sh mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs_with_xalan.sh mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_lastcraft_docs.sh mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_phpdoc_docs.sh mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/pear_package_create.php mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.ini mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/integration.php mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/en/synchronisation.xml mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/no-synchronisation.xml mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/synchronisation.xml mode change 100755 => 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_changelogged.xml create mode 100644 vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/FilterIterator.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php rename vendor/symfony/symfony/src/Symfony/Component/Form/Extension/{Core => HttpFoundation}/EventListener/BindRequestListener.php (97%) create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php rename vendor/symfony/symfony/src/Symfony/Component/Form/{FormConfig.php => FormConfigBuilder.php} (76%) rename vendor/symfony/symfony/src/Symfony/Component/Form/{FormConfigEditorInterface.php => FormConfigBuilderInterface.php} (97%) delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/ImmutableFormConfig.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeFactory.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php rename vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/{Core => HttpFoundation}/EventListener/BindRequestListenerTest.php (91%) create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/LazyOption.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/LazyOptionTest.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Size.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/SizeValidator.php diff --git a/vendor/doctrine/dbal/run-all.sh b/vendor/doctrine/dbal/run-all.sh old mode 100755 new mode 100644 diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php index 92f4739..56d260d 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php @@ -134,6 +134,7 @@ class Configuration implements ConfigurationInterface ->children() ->scalarNode('driver')->defaultValue('pdo_mysql')->end() ->scalarNode('platform_service')->end() + ->scalarNode('schema_filter')->end() ->booleanNode('logging')->defaultValue($this->debug)->end() ->booleanNode('profiling')->defaultValue($this->debug)->end() ->scalarNode('driver_class')->end() @@ -302,6 +303,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('class_metadata_factory_name')->defaultValue('Doctrine\ORM\Mapping\ClassMetadataFactory')->end() ->scalarNode('default_repository_class')->defaultValue('Doctrine\ORM\EntityRepository')->end() ->scalarNode('auto_mapping')->defaultFalse()->end() + ->scalarNode('naming_strategy')->defaultValue('doctrine.orm.naming_strategy.default')->end() ->end() ->fixXmlConfig('hydrator') ->children() diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php index 04a1ec1..308829b 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php @@ -119,6 +119,12 @@ class DoctrineExtension extends AbstractDoctrineExtension } } unset($connection['profiling']); + + if (isset($connection['schema_filter']) && $connection['schema_filter']) { + $configuration->addMethodCall('setFilterSchemaAssetsExpression', array($connection['schema_filter'])); + } + + unset($connection['schema_filter']); if ($logger) { $configuration->addMethodCall('setSQLLogger', array($logger)); @@ -282,6 +288,12 @@ class DoctrineExtension extends AbstractDoctrineExtension 'setClassMetadataFactoryName' => $entityManager['class_metadata_factory_name'], 'setDefaultRepositoryClassName' => $entityManager['default_repository_class'], ); + // check for version to keep BC + if (version_compare(\Doctrine\ORM\Version::VERSION, "2.3.0-DEV") >= 0) { + $methods = array_merge($methods, array( + 'setNamingStrategy' => new Reference($entityManager['naming_strategy']), + )); + } foreach ($methods as $method => $arg) { $ormConfigDef->addMethodCall($method, array($arg)); } diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/orm.xml b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/orm.xml index 211fe7a..5448cdb 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/orm.xml +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/orm.xml @@ -45,6 +45,10 @@ Doctrine\ORM\Tools\ResolveTargetEntityListener + + + Doctrine\ORM\Mapping\DefaultNamingStrategy + Doctrine\ORM\Mapping\UnderscoreNamingStrategy @@ -93,5 +97,9 @@ + + + + diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/schema/doctrine-1.0.xsd b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/schema/doctrine-1.0.xsd index 76170b9..747bcc8 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/schema/doctrine-1.0.xsd +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/schema/doctrine-1.0.xsd @@ -19,6 +19,7 @@ + @@ -161,6 +162,7 @@ + diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst index e6504ef..f921637 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst @@ -30,6 +30,7 @@ Configuration Reference charset: UTF8 logging: %kernel.debug% platform_service: MyOwnDatabasePlatformService + schema_filter: ^sf2_ mapping_types: enum: string conn1: @@ -64,6 +65,7 @@ Configuration Reference test_numeric: Acme\HelloBundle\DQL\NumericFunction datetime_functions: test_datetime: Acme\HelloBundle\DQL\DatetimeFunction + naming_strategy: doctrine.orm.naming_strategy.default # Service Reference em2: # ... @@ -93,6 +95,7 @@ Configuration Reference charset="UTF8" logging="%kernel.debug%" platform-service="MyOwnDatabasePlatformService" + schema-filter="^sf2_" > bar string @@ -102,7 +105,7 @@ Configuration Reference - + @@ -241,6 +244,7 @@ can configure. The following block shows all possible configuration keys: charset: UTF8 logging: %kernel.debug% platform_service: MyOwnDatabasePlatformService + schema_filter: ^sf2_ mapping_types: enum: string types: @@ -268,6 +272,7 @@ can configure. The following block shows all possible configuration keys: charset="UTF8" logging="%kernel.debug%" platform-service="MyOwnDatabasePlatformService" + schema-filter="^sf2_" > bar string diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/views/Collector/db.html.twig b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/views/Collector/db.html.twig index fa2aed3..8dbbf32 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/views/Collector/db.html.twig +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/views/Collector/db.html.twig @@ -3,7 +3,7 @@ {% block toolbar %} {% set icon %} Database - {{ collector.querycount }} + {{ collector.querycount }} in {{ '%0.2f'|format(collector.time * 1000) }} ms {% endset %} {% set text %} diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php index b200fc3..06884dd 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php @@ -194,6 +194,10 @@ abstract class AbstractDoctrineExtensionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('doctrine.orm.default_query_cache', (string) $calls[2][1][0]); $this->assertEquals('doctrine.orm.default_result_cache', (string) $calls[3][1][0]); + if (version_compare(\Doctrine\ORM\Version::VERSION, "2.3.0-DEV") >= 0) { + $this->assertEquals('doctrine.orm.naming_strategy.default', (string) $calls[10][1][0]); + } + $definition = $container->getDefinition('doctrine.orm.default_metadata_cache'); $this->assertEquals('%doctrine.orm.cache.array.class%', $definition->getClass()); @@ -701,6 +705,25 @@ abstract class AbstractDoctrineExtensionTest extends \PHPUnit_Framework_TestCase $this->assertDICDefinitionMethodCallOnce($definition, 'addCustomDatetimeFunction', array('test_datetime', 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestDatetimeFunction')); } + public function testSetNamingStrategy() + { + if (version_compare(\Doctrine\ORM\Version::VERSION, "2.3.0-DEV") < 0) { + $this->markTestSkipped('Naming Strategies are not available'); + } + $container = $this->getContainer(array('YamlBundle')); + + $loader = new DoctrineExtension(); + $container->registerExtension($loader); + $this->loadFromFile($container, 'orm_namingstrategy'); + $this->compileContainer($container); + + $def1 = $container->getDefinition('doctrine.orm.em1_configuration'); + $def2 = $container->getDefinition('doctrine.orm.em2_configuration'); + + $this->assertDICDefinitionMethodCallOnce($def1, 'setNamingStrategy', array(0 => new Reference('doctrine.orm.naming_strategy.default'))); + $this->assertDICDefinitionMethodCallOnce($def2, 'setNamingStrategy', array(0 => new Reference('doctrine.orm.naming_strategy.underscore'))); + } + public function testSingleEMSetCustomFunctions() { $container = $this->getContainer(array('YamlBundle')); @@ -763,6 +786,20 @@ abstract class AbstractDoctrineExtensionTest extends \PHPUnit_Framework_TestCase $this->assertDICDefinitionMethodCallOnce($definition, 'addResolveTargetEntity', array('Symfony\Component\Security\Core\User\UserInterface', 'MyUserClass', array())); $this->assertEquals(array('doctrine.event_listener' => array( array('event' => 'loadClassMetadata') ) ), $definition->getTags()); } + + public function testDbalSchemaFilter() + { + $container = $this->getContainer(); + $loader = new DoctrineExtension(); + $container->registerExtension($loader); + + $this->loadFromFile($container, 'dbal_schema_filter'); + + $this->compileContainer($container); + + $definition = $container->getDefinition('doctrine.dbal.default_connection.configuration'); + $this->assertDICDefinitionMethodCallOnce($definition, 'setFilterSchemaAssetsExpression', array('^sf2_')); + } protected function getContainer($bundles = 'YamlBundle', $vendor = null) { diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/dbal_schema_filter.xml b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/dbal_schema_filter.xml new file mode 100644 index 0000000..2a897bb --- /dev/null +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/dbal_schema_filter.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_namingstrategy.xml b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_namingstrategy.xml new file mode 100644 index 0000000..43a49ee --- /dev/null +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/xml/orm_namingstrategy.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/dbal_schema_filter.yml b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/dbal_schema_filter.yml new file mode 100644 index 0000000..aa8f008 --- /dev/null +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/dbal_schema_filter.yml @@ -0,0 +1,3 @@ +doctrine: + dbal: + schema_filter: ^sf2_ \ No newline at end of file diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_namingstrategy.yml b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_namingstrategy.yml new file mode 100644 index 0000000..95345bb --- /dev/null +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/config/yml/orm_namingstrategy.yml @@ -0,0 +1,18 @@ +doctrine: + dbal: + default_connection: default + connections: + default: + dbname: db + + orm: + default_entity_manager: em1 + entity_managers: + em1: + mappings: + YamlBundle: ~ + naming_strategy: doctrine.orm.naming_strategy.default + em2: + mappings: + YamlBundle: ~ + naming_strategy: doctrine.orm.naming_strategy.underscore diff --git a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/XMLSchemaTest.php b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/XMLSchemaTest.php index c48a68b..9bb17af 100644 --- a/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/XMLSchemaTest.php +++ b/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/DependencyInjection/XMLSchemaTest.php @@ -38,23 +38,28 @@ class XMLSchemaTest extends \PHPUnit_Framework_TestCase $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->load($file); + $xmlns = "http://symfony.com/schema/dic/doctrine"; - $dbalElements = $dom->getElementsByTagNameNS("http://symfony.com/schema/dic/doctrine", "config"); + $dbalElements = $dom->getElementsByTagNameNS($xmlns, 'dbal'); if ($dbalElements->length) { $dbalDom = new \DOMDocument('1.0', 'UTF-8'); $dbalNode = $dbalDom->importNode($dbalElements->item(0)); - $dbalDom->appendChild($dbalNode); + $configNode = $dbalDom->createElementNS($xmlns, 'config'); + $configNode->appendChild($dbalNode); + $dbalDom->appendChild($configNode); $ret = $dbalDom->schemaValidate(__DIR__."/../../Resources/config/schema/doctrine-1.0.xsd"); $this->assertTrue($ret, "DoctrineBundle Dependency Injection XMLSchema did not validate this XML instance."); $found = true; } - $ormElements = $dom->getElementsByTagNameNS("http://symfony.com/schema/dic/doctrine", "config"); + $ormElements = $dom->getElementsByTagNameNS($xmlns, 'orm'); if ($ormElements->length) { $ormDom = new \DOMDocument('1.0', 'UTF-8'); $ormNode = $ormDom->importNode($ormElements->item(0)); - $ormDom->appendChild($ormNode); + $configNode = $ormDom->createElementNS($xmlns, 'config'); + $configNode->appendChild($ormNode); + $ormDom->appendChild($configNode); $ret = $ormDom->schemaValidate(__DIR__."/../../Resources/config/schema/doctrine-1.0.xsd"); $this->assertTrue($ret, "DoctrineBundle Dependency Injection XMLSchema did not validate this XML instance."); diff --git a/vendor/doctrine/migrations b/vendor/doctrine/migrations index fe98141..b86b4cc 160000 --- a/vendor/doctrine/migrations +++ b/vendor/doctrine/migrations @@ -1 +1 @@ -Subproject commit fe98141b1e460baf5ab52f9139e1ae238101b28b +Subproject commit b86b4cc0a39714f0aa53b908d495beacfa0e4011 diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index ace39c4..b71146c 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -142,8 +142,12 @@ class AnnotationDriver implements Driver $classAnnotations = $this->_reader->getClassAnnotations($class); - if ($classAnnotations && is_numeric(key($classAnnotations))) { - foreach ($classAnnotations as $annot) { + if ($classAnnotations) { + foreach ($classAnnotations as $key => $annot) { + if ( ! is_numeric($key)) { + continue; + } + $classAnnotations[get_class($annot)] = $annot; } } @@ -432,8 +436,11 @@ class AnnotationDriver implements Driver if ($method->isPublic() && $method->getDeclaringClass()->getName() == $class->name) { $annotations = $this->_reader->getMethodAnnotations($method); - if ($annotations && is_numeric(key($annotations))) { - foreach ($annotations as $annot) { + if ($annotations) { + foreach ($annotations as $key => $annot) { + if ( ! is_numeric($key)) { + continue; + } $annotations[get_class($annot)] = $annot; } } diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php b/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php index 4c42c29..00bd702 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php @@ -284,7 +284,7 @@ final class PersistentCollection implements Collection /** * INTERNAL: Gets the association mapping of the collection. * - * @return \Doctrine\ORM\Mapping\AssociationMapping + * @return array */ public function getMapping() { diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php index daef037..4e3e92b 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php @@ -178,7 +178,7 @@ class ManyToManyPersister extends AbstractCollectionPersister } // Composite identifier - $sourceClass = $this->_em->getClassMetadata(get_class($mapping->getOwner())); + $sourceClass = $this->_em->getClassMetadata(get_class($coll->getOwner())); foreach ($mapping['relationToSourceKeyColumns'] as $relColumn => $srcColumn) { $params[] = $identifier[$sourceClass->fieldNames[$srcColumn]]; diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php index f85ed5d..c8ddb9c 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php @@ -21,7 +21,6 @@ namespace Doctrine\ORM\Proxy; use Doctrine\ORM\EntityManager, Doctrine\ORM\Mapping\ClassMetadata, - Doctrine\ORM\Mapping\AssociationMapping, Doctrine\Common\Util\ClassUtils; /** diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php index 16c6c38..71a41e5 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php @@ -21,6 +21,7 @@ namespace Doctrine\ORM; use Doctrine\DBAL\LockMode, Doctrine\ORM\Query\Parser, + Doctrine\ORM\Query\ParserResult, Doctrine\ORM\Query\QueryException; /** @@ -218,7 +219,7 @@ final class Query extends AbstractQuery $hash = $this->_getQueryCacheId(); $cached = $this->_expireQueryCache ? false : $queryCache->fetch($hash); - if ($cached !== false) { + if ($cached instanceof ParserResult) { // Cache hit. $this->_parserResult = $cached; diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php index cd74f35..41bfd34 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php @@ -94,7 +94,7 @@ class QueryException extends \Doctrine\ORM\ORMException } /** - * @param \Doctrine\ORM\Mapping\AssociationMapping $assoc + * @param array $assoc */ public static function iterateWithFetchJoinCollectionNotAllowed($assoc) { @@ -151,4 +151,4 @@ class QueryException extends \Doctrine\ORM\ORMException return new self("Cannot check if a child of '" . $rootClass . "' is instanceof '" . $className . "', " . "inheritance hierachy exists between these two classes."); } -} \ No newline at end of file +} diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/EntityGenerator.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/EntityGenerator.php index c78be56..b4564e0 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -20,8 +20,8 @@ namespace Doctrine\ORM\Tools; use Doctrine\ORM\Mapping\ClassMetadataInfo, - Doctrine\ORM\Mapping\AssociationMapping, - Doctrine\Common\Util\Inflector; + Doctrine\Common\Util\Inflector, + Doctrine\DBAL\Types\Type; /** * Generic class used to generate PHP5 entity classes from ClassMetadataInfo instances @@ -143,7 +143,7 @@ public function ($) '/** * * - * @param + * @param $ */ public function ($) { diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php index 5053290..d12c109 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php @@ -23,7 +23,6 @@ namespace Doctrine\ORM\Tools\Export\Driver; use Doctrine\ORM\Mapping\ClassMetadataInfo, - Doctrine\ORM\Mapping\AssociationMapping, Doctrine\ORM\Tools\EntityGenerator; /** @@ -69,4 +68,4 @@ class AnnotationExporter extends AbstractExporter { $this->_entityGenerator = $entityGenerator; } -} \ No newline at end of file +} diff --git a/vendor/doctrine/orm/lib/Doctrine/ORM/Version.php b/vendor/doctrine/orm/lib/Doctrine/ORM/Version.php index 020148e..8d1cf28 100644 --- a/vendor/doctrine/orm/lib/Doctrine/ORM/Version.php +++ b/vendor/doctrine/orm/lib/Doctrine/ORM/Version.php @@ -36,7 +36,7 @@ class Version /** * Current Doctrine Version */ - const VERSION = '2.2.3-DEV'; + const VERSION = '2.2.4-DEV'; /** * Compares a Doctrine version with the current one. diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavPointOfInterest.php b/vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavPointOfInterest.php index 662a57a..33d0f70 100644 --- a/vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavPointOfInterest.php +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavPointOfInterest.php @@ -30,12 +30,25 @@ class NavPointOfInterest */ private $country; + /** + * @ManyToMany(targetEntity="NavUser", cascade={"persist"}) + * @JoinTable(name="navigation_pois_visitors", + * inverseJoinColumns={@JoinColumn(name="user_id", referencedColumnName="id")}, + * joinColumns={ + * @JoinColumn(name="poi_long", referencedColumnName="nav_long"), + * @JoinColumn(name="poi_lat", referencedColumnName="nav_lat") + * } + * ) + */ + private $visitors; + public function __construct($lat, $long, $name, $country) { $this->lat = $lat; $this->long = $long; $this->name = $name; $this->country = $country; + $this->visitors = new \Doctrine\Common\Collections\ArrayCollection; } public function getLong() { @@ -53,4 +66,14 @@ class NavPointOfInterest public function getCountry() { return $this->country; } + + public function addVisitor(NavUser $user) + { + $this->visitors[] = $user; + } + + public function getVisitors() + { + return $this->visitors; + } } diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavUser.php b/vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavUser.php new file mode 100644 index 0000000..42117e4 --- /dev/null +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/Models/Navigation/NavUser.php @@ -0,0 +1,28 @@ +name = $name; + } +} + diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php index 4d321ad..1af930a 100644 --- a/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/CompositePrimaryKeyTest.php @@ -5,6 +5,7 @@ use Doctrine\Tests\Models\Navigation\NavCountry; use Doctrine\Tests\Models\Navigation\NavPointOfInterest; use Doctrine\Tests\Models\Navigation\NavTour; use Doctrine\Tests\Models\Navigation\NavPhotos; +use Doctrine\Tests\Models\Navigation\NavUser; require_once __DIR__ . '/../../TestInit.php'; @@ -118,4 +119,26 @@ class CompositePrimaryKeyTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->setExpectedException('Doctrine\ORM\ORMException', 'The identifier long is missing for a query of Doctrine\Tests\Models\Navigation\NavPointOfInterest'); $poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', array('key1' => 100)); } + + /** + * @group DDC-1939 + */ + public function testDeleteCompositePersistentCollection() + { + $this->putGermanysBrandenburderTor(); + + $poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', array('lat' => 100, 'long' => 200)); + $poi->addVisitor(new NavUser("test1")); + $poi->addVisitor(new NavUser("test2")); + + $this->_em->flush(); + + $poi->getVisitors()->clear(); + + $this->_em->flush(); + $this->_em->clear(); + + $poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', array('lat' => 100, 'long' => 200)); + $this->assertEquals(0, count($poi->getVisitors())); + } } diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/vendor/doctrine/orm/tests/Doctrine/Tests/OrmFunctionalTestCase.php index 4b92ed5..c0895f0 100644 --- a/vendor/doctrine/orm/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -88,6 +88,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase 'Doctrine\Tests\Models\Routing\RoutingRouteBooking', ), 'navigation' => array( + 'Doctrine\Tests\Models\Navigation\NavUser', 'Doctrine\Tests\Models\Navigation\NavCountry', 'Doctrine\Tests\Models\Navigation\NavPhotos', 'Doctrine\Tests\Models\Navigation\NavTour', diff --git a/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetCollectionInterface.php b/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetCollectionInterface.php index 710e75a..a5a9bac 100644 --- a/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetCollectionInterface.php +++ b/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetCollectionInterface.php @@ -37,7 +37,7 @@ interface AssetCollectionInterface extends AssetInterface, \Traversable * * @param AssetInterface $needle The leaf to remove * - * @throws InvalidArgumentException If the asset cannot be found + * @throws \InvalidArgumentException If the asset cannot be found */ function removeLeaf(AssetInterface $leaf); diff --git a/vendor/kriswallsmith/assetic/src/Assetic/Asset/FileAsset.php b/vendor/kriswallsmith/assetic/src/Assetic/Asset/FileAsset.php index 0bf171c..d622950 100644 --- a/vendor/kriswallsmith/assetic/src/Assetic/Asset/FileAsset.php +++ b/vendor/kriswallsmith/assetic/src/Assetic/Asset/FileAsset.php @@ -31,7 +31,7 @@ class FileAsset extends BaseAsset * @param string $sourceRoot The source asset root directory * @param string $sourcePath The source asset path * - * @throws InvalidArgumentException If the supplied root doesn't match the source when guessing the path + * @throws \InvalidArgumentException If the supplied root doesn't match the source when guessing the path */ public function __construct($source, $filters = array(), $sourceRoot = null, $sourcePath = null, array $vars = array()) { diff --git a/vendor/kriswallsmith/assetic/src/Assetic/Asset/HttpAsset.php b/vendor/kriswallsmith/assetic/src/Assetic/Asset/HttpAsset.php index 64f2437..d1dcfe0 100644 --- a/vendor/kriswallsmith/assetic/src/Assetic/Asset/HttpAsset.php +++ b/vendor/kriswallsmith/assetic/src/Assetic/Asset/HttpAsset.php @@ -31,7 +31,7 @@ class HttpAsset extends BaseAsset * @param string $sourceUrl The source URL * @param array $filters An array of filters * - * @throws InvalidArgumentException If the first argument is not an URL + * @throws \InvalidArgumentException If the first argument is not an URL */ public function __construct($sourceUrl, $filters = array(), $ignoreErrors = false, array $vars = array()) { diff --git a/vendor/kriswallsmith/assetic/src/Assetic/AssetManager.php b/vendor/kriswallsmith/assetic/src/Assetic/AssetManager.php index 230e4fc..0746356 100644 --- a/vendor/kriswallsmith/assetic/src/Assetic/AssetManager.php +++ b/vendor/kriswallsmith/assetic/src/Assetic/AssetManager.php @@ -29,7 +29,7 @@ class AssetManager * * @return AssetInterface The asset * - * @throws InvalidArgumentException If there is no asset by that name + * @throws \InvalidArgumentException If there is no asset by that name */ public function get($name) { diff --git a/vendor/kriswallsmith/assetic/src/Assetic/Extension/Twig/AsseticNode.php b/vendor/kriswallsmith/assetic/src/Assetic/Extension/Twig/AsseticNode.php index c60daee..ac823b7 100644 --- a/vendor/kriswallsmith/assetic/src/Assetic/Extension/Twig/AsseticNode.php +++ b/vendor/kriswallsmith/assetic/src/Assetic/Extension/Twig/AsseticNode.php @@ -25,7 +25,7 @@ class AsseticNode extends \Twig_Node * * var_name: The name of the variable to expose to the body node * * @param AssetInterface $asset The asset - * @param Twig_NodeInterface $body The body node + * @param \Twig_NodeInterface $body The body node * @param array $inputs An array of input strings * @param array $filters An array of filter strings * @param string $name The name of the asset diff --git a/vendor/kriswallsmith/assetic/src/Assetic/Factory/LazyAssetManager.php b/vendor/kriswallsmith/assetic/src/Assetic/Factory/LazyAssetManager.php index 9a5fa13..d742279 100644 --- a/vendor/kriswallsmith/assetic/src/Assetic/Factory/LazyAssetManager.php +++ b/vendor/kriswallsmith/assetic/src/Assetic/Factory/LazyAssetManager.php @@ -111,7 +111,7 @@ class LazyAssetManager extends AssetManager * * @return array The formula * - * @throws InvalidArgumentException If there is no formula by that name + * @throws \InvalidArgumentException If there is no formula by that name */ public function getFormula($name) { @@ -140,7 +140,7 @@ class LazyAssetManager extends AssetManager /** * Loads formulae from resources. * - * @throws LogicException If a resource has been added to an invalid loader + * @throws \LogicException If a resource has been added to an invalid loader */ public function load() { diff --git a/vendor/kriswallsmith/assetic/src/Assetic/FilterManager.php b/vendor/kriswallsmith/assetic/src/Assetic/FilterManager.php index ddf6cac..ee7a37a 100644 --- a/vendor/kriswallsmith/assetic/src/Assetic/FilterManager.php +++ b/vendor/kriswallsmith/assetic/src/Assetic/FilterManager.php @@ -53,7 +53,7 @@ class FilterManager * * @param string $name An asset name candidate * - * @throws InvalidArgumentException If the asset name is invalid + * @throws \InvalidArgumentException If the asset name is invalid */ protected function checkName($name) { diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build.sh b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build.sh old mode 100755 new mode 100644 diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php old mode 100755 new mode 100644 diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Configuration/ParamConverter.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Configuration/ParamConverter.php index 89afc2e..66dfcc5 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Configuration/ParamConverter.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Configuration/ParamConverter.php @@ -49,6 +49,13 @@ class ParamConverter extends ConfigurationAnnotation */ protected $optional = false; + /** + * Use explicitly named converter instead of iterating by priorities. + * + * @var string + */ + protected $converter; + /** * Returns the parameter name. * @@ -139,6 +146,26 @@ class ParamConverter extends ConfigurationAnnotation return $this->optional; } + /** + * Get explicit converter name. + * + * @return string + */ + public function getConverter() + { + return $this->converter; + } + + /** + * Set explicit converter name + * + * @param string $converter + */ + public function setConverter($converter) + { + $this->converter = $converter; + } + /** * Returns the annotation alias name. * diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/DependencyInjection/Compiler/AddParamConverterPass.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/DependencyInjection/Compiler/AddParamConverterPass.php index b739e0b..be39dae 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/DependencyInjection/Compiler/AddParamConverterPass.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/DependencyInjection/Compiler/AddParamConverterPass.php @@ -29,8 +29,18 @@ class AddParamConverterPass implements CompilerPassInterface } $definition = $container->getDefinition('sensio_framework_extra.converter.manager'); - foreach ($container->findTaggedServiceIds('request.param_converter') as $id => $attributes) { - $definition->addMethodCall('add', array(new Reference($id), isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0)); + + foreach ($container->findTaggedServiceIds('request.param_converter') as $id => $converters) { + foreach ($converters as $converter) { + $name = isset($converter['converter']) ? $converter['converter'] : null; + $priority = isset($converter['priority']) ? $converter['priority'] : 0; + + if ($priority === "false") { + $priority = null; + } + + $definition->addMethodCall('add', array(new Reference($id), $priority, $name)); + } } } } diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ControllerListener.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ControllerListener.php index 33f5d62..a4fb72f 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ControllerListener.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ControllerListener.php @@ -5,6 +5,7 @@ namespace Sensio\Bundle\FrameworkExtraBundle\EventListener; use Doctrine\Common\Annotations\Reader; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface; +use Doctrine\Common\Util\ClassUtils; /* * This file is part of the Symfony framework. @@ -51,14 +52,33 @@ class ControllerListener return; } - $object = new \ReflectionObject($controller[0]); - $method = $object->getMethod($controller[1]); + $className = class_exists('Doctrine\Common\Util\ClassUtils') ? ClassUtils::getClass($controller[0]) : get_class($controller[0]); + $object = new \ReflectionClass($className); + $method = $object->getMethod($controller[1]); + + $classConfigurations = $this->getConfigurations($this->reader->getClassAnnotations($object)); + $methodConfigurations = $this->getConfigurations($this->reader->getMethodAnnotations($method)); + + $configurations = array_merge($classConfigurations, $methodConfigurations); $request = $event->getRequest(); - foreach (array_merge($this->reader->getClassAnnotations($object), $this->reader->getMethodAnnotations($method)) as $configuration) { - if ($configuration instanceof ConfigurationInterface) { - $request->attributes->set('_'.$configuration->getAliasName(), $configuration); + foreach ($configurations as $key => $attributes) { + if (is_array($attributes) && count($attributes) == 1) { + $attributes = $attributes[0]; } + $request->attributes->set($key, $attributes); } } + + protected function getConfigurations(array $annotations) + { + $configurations = array(); + foreach ($annotations as $configuration) { + if ($configuration instanceof ConfigurationInterface) { + $configurations['_'.$configuration->getAliasName()][] = $configuration; + } + } + + return $configurations; + } } diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ParamConverterListener.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ParamConverterListener.php index b6df11e..30a71dc 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ParamConverterListener.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ParamConverterListener.php @@ -63,7 +63,7 @@ class ParamConverterListener // automatically apply conversion for non-configured objects foreach ($r->getParameters() as $param) { - if (!$param->getClass()) { + if (!$param->getClass() || $param->getClass()->isInstance($request)) { continue; } @@ -75,6 +75,8 @@ class ParamConverterListener $configuration->setClass($param->getClass()->getName()); $configurations[$name] = $configuration; + } elseif (null === $configurations[$name]->getClass()) { + $configurations[$name]->setClass($param->getClass()->getName()); } $configurations[$name]->setIsOptional($param->isOptional()); diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DateTimeParamConverter.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DateTimeParamConverter.php new file mode 100644 index 0000000..61c3cd6 --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DateTimeParamConverter.php @@ -0,0 +1,59 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter; + +use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use DateTime; + +/** + * Convert DateTime instances from request attribute variable. + * + * @author Benjamin Eberlei + */ +class DateTimeParamConverter implements ParamConverterInterface +{ + public function apply(Request $request, ConfigurationInterface $configuration) + { + $param = $configuration->getName(); + + if (!$request->attributes->has($param)) { + return false; + } + + $options = $configuration->getOptions(); + $value = $request->attributes->get($param); + + $date = isset($options['format']) + ? DateTime::createFromFormat($options['format'], $value) + : new DateTime($value); + + if (!$date) { + throw new NotFoundHttpException('Invalid date given.'); + } + + $request->attributes->set($param, $date); + + return true; + } + + public function supports(ConfigurationInterface $configuration) + { + if (null === $configuration->getClass()) { + return false; + } + + return "DateTime" === $configuration->getClass(); + } +} + diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php index 0c6ae52..9197a6e 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php @@ -35,14 +35,19 @@ class DoctrineParamConverter implements ParamConverterInterface public function apply(Request $request, ConfigurationInterface $configuration) { - $class = $configuration->getClass(); + $name = $configuration->getName(); + $class = $configuration->getClass(); $options = $this->getOptions($configuration); // find by identifier? - if (false === $object = $this->find($class, $request, $options)) { + if (false === $object = $this->find($class, $request, $options, $name)) { // find by criteria if (false === $object = $this->findOneBy($class, $request, $options)) { - throw new \LogicException('Unable to guess how to get a Doctrine instance from the request information.'); + if ($configuration->isOptional()) { + $object = null; + } else { + throw new \LogicException('Unable to guess how to get a Doctrine instance from the request information.'); + } } } @@ -50,28 +55,72 @@ class DoctrineParamConverter implements ParamConverterInterface throw new NotFoundHttpException(sprintf('%s object not found.', $class)); } - $request->attributes->set($configuration->getName(), $object); + $request->attributes->set($name, $object); return true; } - protected function find($class, Request $request, $options) + protected function find($class, Request $request, $options, $name) { - $key = isset($options['id']) ? $options['id'] : 'id'; - if (!$request->attributes->has($key)) { + if ($options['mapping'] || $options['exclude']) { return false; } - return $this->registry->getRepository($class, $options['entity_manager'])->find($request->attributes->get($key)); + $id = $this->getIdentifier($request, $options, $name); + + if (!$id) { + return false; + } + + return $this->registry->getRepository($class, $options['entity_manager'])->find($id); + } + + protected function getIdentifier(Request $request, $options, $name) + { + if (isset($options['id'])) { + if (!is_array($options['id'])) { + $name = $options['id']; + } elseif (is_array($options['id'])) { + $id = array(); + foreach ($options['id'] as $field) { + $id[$field] = $request->attributes->get($field); + } + return $id; + } + } + + if ($request->attributes->has($name)) { + return $request->attributes->get($name); + } + + if ($request->attributes->has('id')) { + return $request->attributes->get('id'); + } + + return false; } protected function findOneBy($class, Request $request, $options) { + if (!$options['mapping']) { + $keys = $request->attributes->keys(); + $options['mapping'] = $keys ? array_combine($keys, $keys) : array(); + } + + foreach ($options['exclude'] as $exclude) { + unset($options['mapping'][$exclude]); + } + + if (!$options['mapping']) { + return false; + } + $criteria = array(); $metadata = $this->registry->getManager($options['entity_manager'])->getClassMetadata($class); - foreach ($request->attributes->all() as $key => $value) { - if ($metadata->hasField($key)) { - $criteria[$key] = $value; + + foreach ($options['mapping'] as $attribute => $field) { + if ($metadata->hasField($field) || ($metadata->hasAssociation($field) && $metadata->isSingleValuedAssociation($field))) { + $criteria[$field] = $request->attributes->get($attribute); } } @@ -84,7 +133,8 @@ class DoctrineParamConverter implements ParamConverterInterface public function supports(ConfigurationInterface $configuration) { - if (null === $this->registry) { + // if there is no manager, this means that only Doctrine DBAL is configured + if (null === $this->registry || !count($this->registry->getManagers())) { return false; } @@ -104,6 +154,8 @@ class DoctrineParamConverter implements ParamConverterInterface { return array_replace(array( 'entity_manager' => null, + 'exclude' => array(), + 'mapping' => array(), ), $configuration->getOptions()); } } diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/ParamConverterManager.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/ParamConverterManager.php index 85e7c22..1bdd998 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/ParamConverterManager.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/ParamConverterManager.php @@ -26,6 +26,11 @@ class ParamConverterManager */ protected $converters = array(); + /** + * @var array + */ + protected $namedConverters = array(); + /** * Applies all converters to the passed configurations and stops when a * converter is applied it will move on to the next configuration and so on. @@ -40,19 +45,52 @@ class ParamConverterManager } foreach ($configurations as $configuration) { - // If the value is already an instance of the class we are trying to convert it into - // we should continue as no convertion is required - $value = $request->attributes->get($configuration->getName()); - $className = $configuration->getClass(); - if (is_object($value) && $value instanceof $className) { - continue; + $this->applyConverter($request, $configuration); + } + } + + /** + * Apply converter on request based on the given configuration. + * + * @param Request $request + * @param ConfigurationInterface $configuration + */ + protected function applyConverter(Request $request, $configuration) + { + $value = $request->attributes->get($configuration->getName()); + $className = $configuration->getClass(); + + // If the value is already an instance of the class we are trying to convert it into + // we should continue as no convertion is required + if (is_object($value) && $value instanceof $className) { + return; + } + + if ($converterName = $configuration->getConverter()) { + if (!isset($this->namedConverters[$converterName])) { + throw new \RuntimeException(sprintf( + "No converter named '%s' found for conversion of parameter '%s'.", + $converterName, $configuration->getName() + )); } - foreach ($this->all() as $converter) { - if ($converter->supports($configuration)) { - if ($converter->apply($request, $configuration)) { - continue 2; - } + $converter = $this->namedConverters[$converterName]; + + if (!$converter->supports($configuration)) { + throw new \RuntimeException(sprintf( + "Converter '%s' does not support conversion of parameter '%s'.", + $converterName, $configuration->getName() + )); + } + + $converter->apply($request, $configuration); + return; + } + + foreach ($this->all() as $converter) { + if ($converter->supports($configuration)) { + if ($converter->apply($request, $configuration)) { + return; } } } @@ -61,16 +99,28 @@ class ParamConverterManager /** * Adds a parameter converter. * + * Converters match either explicitly via $name or by iteration over all + * converters with a $priority. If you pass a $priority = null then the + * added converter will not be part of the iteration chain and can only + * be invoked explicitly. + * * @param ParamConverterInterface $converter A ParamConverterInterface instance - * @param integer $priority The priority (between -10 and 10) + * @param integer $priority The priority (between -10 and 10). + * @param string $name Name of the converter. */ - public function add(ParamConverterInterface $converter, $priority = 0) + public function add(ParamConverterInterface $converter, $priority = 0, $name = null) { - if (!isset($this->converters[$priority])) { - $this->converters[$priority] = array(); - } + if ($priority !== null) { + if (!isset($this->converters[$priority])) { + $this->converters[$priority] = array(); + } - $this->converters[$priority][] = $converter; + $this->converters[$priority][] = $converter; + } + + if (null !== $name) { + $this->namedConverters[$name] = $converter; + } } /** diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/config/converters.xml b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/config/converters.xml index 8f7170e..dd8a535 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/config/converters.xml +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/config/converters.xml @@ -8,6 +8,7 @@ Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter + Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DateTimeParamConverter @@ -19,8 +20,12 @@ - + + + + + diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/converters.rst b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/converters.rst index ca4cfe4..633bb3b 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/converters.rst +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/converters.rst @@ -41,14 +41,42 @@ If you use type hinting as in the example above, you can even omit the { } +To detect which converter is run on a parameter the following process is run: + +* If an explicit converter choice was made with + ``@ParamConverter(converter="name")`` the converter with the given name is + chosen. +* Otherwise all registered parameter converters are iterated by priority. + The ``supports()`` method is invoked to check if a param converter can + convert the request into the required parameter. If it returns ``true`` + the param converter is invoked. + Built-in Converters ------------------- -The bundle has only one built-in converter, the Doctrine one. +The bundle has two built-in converter, the Doctrine one and a DateTime +converter. Doctrine Converter ~~~~~~~~~~~~~~~~~~ +Converter Name: ``doctrine.orm`` + +The Doctrine Converter attempts to convert request attributes to Doctrine +entities fetched from the database. Two different approaches are possible: + +- Fetch object by primary key +- Fetch object by one or several fields which contain unique values in the + database. + +The following algorithm determines which operation will be performed. + +- If an ``{id}`` parameter is present in the route, find object by primary key. +- If an option ``'id'`` is configured and matches route parameters, find object by primary key. +- If the previous rules do not apply, attempt to find one entity by matching + route parameters to entity fields. You can control this process by + configuring ``exclude`` parameters or a attribute to field name ``mapping``. + By default, the Doctrine converter uses the *default* entity manager. This can be configured with the ``entity_manager`` option:: @@ -87,6 +115,55 @@ This also allows you to have multiple converters in one action:: In the example above, the post parameter is handled automatically, but the comment is configured with the annotation since they can not both follow the default convention. +If you want to match an entity using multiple fields use ``mapping``:: + + /** + * @Route("/blog/{date}/{slug}/comments/{comment_slug}") + * @ParamConverter("post", options={"mapping": {"date": "date", "slug": "slug"}) + * @ParamConverter("comment", options={"mapping": {"comment_slug": "slug"}) + */ + public function showAction(Post $post, Comment $comment) + { + } + +If you are matching an entity using several fields, but you want to exclude a +route parameter from being part of the criteria:: + + /** + * @Route("/blog/{date}/{slug}") + * @ParamConverter("post", options={"exclude": ["date"]}) + */ + public function showAction(Post $post, \DateTime $date) + { + } + +DateTime Converter +~~~~~~~~~~~~~~~~~~ + +Converter Name: ``datetime`` + +The datetime converter converts any route or request attribute into a datetime +instance:: + + /** + * @Route("/blog/archive/{start}/{end}") + */ + public function archiveAction(DateTime $start, DateTime $end) + { + } + +By default any date format that can be parsed by the ``DateTime`` constructor +is accepted. You can be stricter with input given through the options:: + + /** + * @Route("/blog/archive/{start}/{end}") + * @ParamConverter("start", options={"format": "Y-m-d"}) + * @ParamConverter("end", options={"format": "Y-m-d"}) + */ + public function archiveAction(DateTime $start, DateTime $end) + { + } + Creating a Converter -------------------- @@ -120,6 +197,21 @@ on the request attributes, it should set an attribute named ``$configuration->getName()``, which stores an object of class ``$configuration->getClass()``. +To register your converter service you must add a tag to your service + +.. configuration-block:: + + .. code-block:: xml + + + + + +You can register a converter by priority, by name or both. If you don't +specifiy a priority or name the converter will be added to the converter stack +with a priority of `0`. To explicitly disable the registration by priority you +have to set `priority="false"` in your tag definition. + .. tip:: Use the ``DoctrineParamConverter`` class as a template for your own converters. diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/view.rst b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/view.rst index d96f94a..92ff80e 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/view.rst +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/view.rst @@ -40,6 +40,19 @@ case for the above example, you can even omit the annotation value:: return array('post' => $post); } +..note:: + + If you are using PHP as a templating system, you need to make it + explicit:: + + /** + * @Template(engine="php") + */ + public function showAction($id) + { + // ... + } + And if the only parameters to pass to the template are method arguments, you can use the ``vars`` attribute instead of returning an array. This is very useful in combination with the ``@ParamConverter`` :doc:`annotation diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Routing/AnnotatedRouteControllerLoader.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Routing/AnnotatedRouteControllerLoader.php index 1c19900..1396abc 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Routing/AnnotatedRouteControllerLoader.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Routing/AnnotatedRouteControllerLoader.php @@ -4,6 +4,7 @@ namespace Sensio\Bundle\FrameworkExtraBundle\Routing; use Symfony\Component\Routing\Loader\AnnotationClassLoader; use Symfony\Component\Routing\Route; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route as FrameworkExtraBundleRoute; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; /* @@ -37,7 +38,7 @@ class AnnotatedRouteControllerLoader extends AnnotationClassLoader { // controller $classAnnot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass); - if ($classAnnot && $service = $classAnnot->getService()) { + if ($classAnnot instanceof FrameworkExtraBundleRoute && $service = $classAnnot->getService()) { $route->setDefault('_controller', $service.':'.$method->getName()); } else { $route->setDefault('_controller', $class->getName().'::'.$method->getName()); diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Templating/TemplateGuesser.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Templating/TemplateGuesser.php index e2e2616..f80b2eb 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Templating/TemplateGuesser.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Templating/TemplateGuesser.php @@ -5,8 +5,7 @@ namespace Sensio\Bundle\FrameworkExtraBundle\Templating; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference; - -use CG\Core\ClassUtils; +use Doctrine\Common\Util\ClassUtils; /* * This file is part of the Symfony framework. @@ -51,12 +50,7 @@ class TemplateGuesser */ public function guessTemplateName($controller, Request $request, $engine = 'twig') { - $className = get_class($controller[0]); - - // When JMSSecurityExtraBundle is used it generates Controller classes as MyAccountController__CG__ - if (class_exists('CG\\Core\\ClassUtils')) { - $className = ClassUtils::getUserClass($className); - } + $className = class_exists('Doctrine\Common\Util\ClassUtils') ? ClassUtils::getClass($controller[0]) : get_class($controller[0]); if (!preg_match('/Controller\\\(.+)Controller$/', $className, $matchController)) { throw new \InvalidArgumentException(sprintf('The "%s" class does not look like a controller class (it must be in a "Controller" sub-namespace and the class name must end with "Controller")', get_class($controller[0]))); diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ControllerListenerTest.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ControllerListenerTest.php index 712832f..7dc59b6 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ControllerListenerTest.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ControllerListenerTest.php @@ -64,6 +64,25 @@ class ControllerListenerTest extends \PHPUnit_Framework_TestCase $this->assertEquals(FooControllerCacheAtClassAndMethod::CLASS_SMAXAGE, $this->getReadedCache()->getSMaxAge()); } + public function testMultipleAnnotationsOnMethod() + { + $controller = new FooControllerCacheAtClassAndMethod(); + $this->event = $this->getFilterControllerEvent(array($controller, 'bar3Action'), $this->request); + $this->listener->onKernelController($this->event); + + $annotations = $this->getReadedCache(); + $this->assertNotNull($annotations); + $this->assertArrayHasKey(0, $annotations); + $this->assertInstanceOf('Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache', $annotations[0]); + $this->assertEquals(FooControllerCacheAtClassAndMethod::METHOD_SMAXAGE, $annotations[0]->getSMaxAge()); + + $this->assertArrayHasKey(1, $annotations); + $this->assertInstanceOf('Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache', $annotations[1]); + $this->assertEquals(FooControllerCacheAtClassAndMethod::METHOD_SECOND_SMAXAGE, $annotations[1]->getSMaxAge()); + + $this->assertEquals(2, count($annotations)); + } + protected function createRequest(Cache $cache = null) { return new Request(array(), array(), array( diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtClassAndMethod.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtClassAndMethod.php index 6b1d4ef..b427821 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtClassAndMethod.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtClassAndMethod.php @@ -11,6 +11,7 @@ class FooControllerCacheAtClassAndMethod { const CLASS_SMAXAGE = 20; const METHOD_SMAXAGE = 15; + const METHOD_SECOND_SMAXAGE = 25; /** * @Cache(smaxage="15") @@ -22,4 +23,12 @@ class FooControllerCacheAtClassAndMethod public function bar2Action() { } + + /** + * @Cache(smaxage="15") + * @Cache(smaxage="25") + */ + public function bar3Action() + { + } } diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ParamConverterListenerTest.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ParamConverterListenerTest.php new file mode 100644 index 0000000..ca372f3 --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ParamConverterListenerTest.php @@ -0,0 +1,34 @@ +getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); + $request = new Request(); + + $manager = $this->getMock('Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager'); + $manager->expects($this->once()) + ->method('apply') + ->with($this->equalTo($request), $this->equalTo(array())); + + $listener = new ParamConverterListener($manager); + $event = new FilterControllerEvent($kernel, array(new TestController(), 'execute'), $request, null); + + $listener->onKernelController($event); + } +} + +class TestController +{ + public function execute(Request $request) {} +} + diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/DateTimeParamConverterTest.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/DateTimeParamConverterTest.php new file mode 100644 index 0000000..544c14e --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/DateTimeParamConverterTest.php @@ -0,0 +1,69 @@ +converter = new DateTimeParamConverter(); + } + + public function testSupports() + { + $config = $this->createConfiguration("DateTime"); + $this->assertTrue($this->converter->supports($config)); + + $config = $this->createConfiguration(__CLASS__); + $this->assertFalse($this->converter->supports($config)); + + $config = $this->createConfiguration(); + $this->assertFalse($this->converter->supports($config)); + } + + public function testApply() + { + $request = new Request(array(), array(), array('start' => '2012-07-21 00:00:00')); + $config = $this->createConfiguration("DateTime", "start"); + + $this->converter->apply($request, $config); + + $this->assertInstanceOf("DateTime", $request->attributes->get('start')); + $this->assertEquals('2012-07-21', $request->attributes->get('start')->format('Y-m-d')); + } + + public function testApplyWithFormatInvalidDate404Exception() + { + $request = new Request(array(), array(), array('start' => '2012-07-21')); + $config = $this->createConfiguration("DateTime", "start"); + $config->expects($this->any())->method('getOptions')->will($this->returnValue(array('format' => 'd.m.Y'))); + + $this->setExpectedException('Symfony\Component\HttpKernel\Exception\NotFoundHttpException', 'Invalid date given.'); + $this->converter->apply($request, $config); + } + + public function createConfiguration($class = null, $name = null) + { + $config = $this->getMock( + 'Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface', array( + 'getClass', 'getAliasName', 'getOptions', 'getName', + )); + if ($name !== null) { + $config->expects($this->any()) + ->method('getName') + ->will($this->returnValue($name)); + } + if ($class !== null) { + $config->expects($this->any()) + ->method('getClass') + ->will($this->returnValue($class)); + } + + return $config; + } +} diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/DoctrineParamConverterTest.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/DoctrineParamConverterTest.php index 7822cc0..e9090b0 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/DoctrineParamConverterTest.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/DoctrineParamConverterTest.php @@ -27,11 +27,11 @@ class DoctrineParamConverterTest extends \PHPUnit_Framework_TestCase $this->converter = new DoctrineParamConverter($this->manager); } - public function createConfiguration($class = null, array $options = null) + public function createConfiguration($class = null, array $options = null, $name = 'arg', $isOptional = false) { $config = $this->getMock( 'Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface', array( - 'getClass', 'getAliasName', 'getOptions' + 'getClass', 'getAliasName', 'getOptions', 'isOptional', 'getName', )); if ($options !== null) { $config->expects($this->once()) @@ -43,6 +43,12 @@ class DoctrineParamConverterTest extends \PHPUnit_Framework_TestCase ->method('getClass') ->will($this->returnValue($class)); } + $config->expects($this->any()) + ->method('getName') + ->will($this->returnValue($name)); + $config->expects($this->any()) + ->method('isOptional') + ->will($this->returnValue($isOptional)); return $config; } @@ -53,13 +59,86 @@ class DoctrineParamConverterTest extends \PHPUnit_Framework_TestCase $config = $this->createConfiguration(null, array()); $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); - $this->manager->expects($this->never())->method('find'); + $this->setExpectedException('LogicException'); + $this->converter->apply($request, $config); + } + + public function testApplyWithNoIdAndDataOptional() + { + $request = new Request(); + $config = $this->createConfiguration(null, array(), 'arg', true); + $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); + + $ret = $this->converter->apply($request, $config); + + $this->assertTrue($ret); + $this->assertNull($request->attributes->get('arg')); + } + + public function testApplyWithId() + { + $request = new Request(); + $request->attributes->set('id', 1); + + $config = $this->createConfiguration('stdClass', array('id' => 'id'), 'arg'); + + $objectRepository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository'); + $this->manager->expects($this->once()) + ->method('getRepository') + ->will($this->returnValue($objectRepository)); + + $objectRepository->expects($this->once()) + ->method('find') + ->with($this->equalTo(1)) + ->will($this->returnValue($object =new \stdClass)); + + $ret = $this->converter->apply($request, $config); + + $this->assertTrue($ret); + $this->assertSame($object, $request->attributes->get('arg')); + } + + public function testApplyWithMappingAndExclude() + { + $request = new Request(); + $request->attributes->set('foo', 1); + $request->attributes->set('bar', 2); + + $config = $this->createConfiguration( + 'stdClass', + array('mapping' => array('foo' => 'Foo'), 'exclude' => array('bar')), + 'arg' + ); + + $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + $this->manager->expects($this->once()) ->method('getManager') ->will($this->returnValue($objectManager)); + $objectManager->expects($this->once()) + ->method('getClassMetadata') + ->will($this->returnValue($metadata)); - $this->setExpectedException('LogicException'); - $this->converter->apply($request, $config); + $metadata->expects($this->once()) + ->method('hasField') + ->with($this->equalTo('Foo')) + ->will($this->returnValue(true)); + + $objectRepository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository'); + $this->manager->expects($this->once()) + ->method('getRepository') + ->will($this->returnValue($objectRepository)); + + $objectRepository->expects($this->once()) + ->method('findOneBy') + ->with($this->equalTo(array('Foo' => 1))) + ->will($this->returnValue($object =new \stdClass)); + + $ret = $this->converter->apply($request, $config); + + $this->assertTrue($ret); + $this->assertSame($object, $request->attributes->get('arg')); } public function testSupports() @@ -76,6 +155,10 @@ class DoctrineParamConverterTest extends \PHPUnit_Framework_TestCase ->method('getMetadataFactory') ->will($this->returnValue($metadataFactory)); + $this->manager->expects($this->once()) + ->method('getManagers') + ->will($this->returnValue(array($objectManager))); + $this->manager->expects($this->once()) ->method('getManager') ->will($this->returnValue($objectManager)); diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/ParamConverterManagerTest.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/ParamConverterManagerTest.php index ef623ae..7c26206 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/ParamConverterManagerTest.php +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/ParamConverterManagerTest.php @@ -65,6 +65,73 @@ class ParamConverterManagerTest extends \PHPUnit_Framework_TestCase $this->manager->apply(new Request(), $configurations); } + public function testApplyNamedConverter() + { + $converter = $this->createParamConverterMock(); + $converter + ->expects($this->any()) + ->method('supports') + ->will($this->returnValue(True)) + ; + + $converter + ->expects($this->any()) + ->method('apply') + ; + + $this->manager->add($converter, 0, "test"); + + $request = new Request(); + $request->attributes->set('param', '1234'); + + $configuration = new Configuration\ParamConverter(array( + 'name' => 'param', + 'class' => 'stdClass', + 'converter' => 'test', + )); + + $this->manager->apply($request, array($configuration)); + } + + public function testApplyNamedConverterNotSupportsParameter() + { + $converter = $this->createParamConverterMock(); + $converter + ->expects($this->any()) + ->method('supports') + ->will($this->returnValue(false)) + ; + + $this->manager->add($converter, 0, "test"); + + $request = new Request(); + $request->attributes->set('param', '1234'); + + $configuration = new Configuration\ParamConverter(array( + 'name' => 'param', + 'class' => 'stdClass', + 'converter' => 'test', + )); + + $this->setExpectedException("RuntimeException", "Converter 'test' does not support conversion of parameter 'param'."); + $this->manager->apply($request, array($configuration)); + } + + public function testApplyNamedConverterNoConverter() + { + $request = new Request(); + $request->attributes->set('param', '1234'); + + $configuration = new Configuration\ParamConverter(array( + 'name' => 'param', + 'class' => 'stdClass', + 'converter' => 'test', + )); + + $this->setExpectedException("RuntimeException", "No converter named 'test' found for conversion of parameter 'param'."); + $this->manager->apply($request, array($configuration)); + } + public function testApplyNotCalledOnAlreadyConvertedObjects() { diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/UPGRADE.md b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/UPGRADE.md new file mode 100644 index 0000000..692f1f1 --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/UPGRADE.md @@ -0,0 +1,50 @@ +UPGRADE FROM 2.0 to 2.1 +======================= + +### DoctrineParamConverter: Request Attributes with same name as Arguments + +Previously the DoctrineParamConverter defaulted to finding objects by 'id' +parameter. This is unintuitive and is now overwritten by a behavior where +the request attributes with the same name as entity arguments is matched +with higher priority. + +This might cause problems if you are using this parameter for another object conversion. + +### DoctrineParamConverter with multiple Arguments may clash + +In 2.0 the parameter converter matched only entity fields against route parameters. +With 2.1, the matching now also includes single-valued associations. Depending +on fields in entities this might lead to clashes when you update to the latest version. + +Example that may break with the latest (2.1) version: + + /** + * @Route("/user/{email}/{address}") + * @ParamConverter("address", class="MyBundle:Address", options={"id": "address"}) + */ + public function showAction(User $user, Address $address) + { + } + + class User + { + /** @ORM\Column(type="string") */ + public $email; + /** @ORM\ManyToOne(targetEntity="Address") */ + public $address; + } + +Since address exists as field in `User` and User is not searched by primary key but +by field, this scenario now adds `address` to the criteria to find a user instance. +In scenarios of related entities this might even (just) work, but you never know. + +You can fix this by configuring explicit mapping for `User`: + + /** + * @Route("/user/{email}/{address}") + * @ParamConverter("address", options={"id": "address"}) + * @ParamConverter("email", options={"exclude": ["address"]}) + */ + public function showAction(User $user, Address $address) + { + } diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/composer.json b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/composer.json index 793388d..5935192 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/composer.json +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/composer.json @@ -22,5 +22,6 @@ "branch-alias": { "dev-master": "2.1.x-dev" } - } + }, + "minimum-stability": "dev" } diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Command/GenerateBundleCommand.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Command/GenerateBundleCommand.php index f40468d..c326907 100644 --- a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Command/GenerateBundleCommand.php +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Command/GenerateBundleCommand.php @@ -148,7 +148,7 @@ EOT 'See http://symfony.com/doc/current/cookbook/bundles/best_practices.html#index-1 for more', 'details on bundle naming conventions.', '', - 'Use / instead of \\ for the namespace delimiter to avoid any problem.', + 'Use / instead of \\ for the namespace delimiter to avoid any problem.', '', )); diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-contribute.png b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-contribute.png old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.heartbeat.js b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.heartbeat.js old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.sparkline.js b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.sparkline.js old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/heartbeat.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/heartbeat.php old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/changelog.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/changelog.xml old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/heartbeat.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/heartbeat.xml old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/sample.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/sample.php old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/test.php old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/build_tarball.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/build_tarball.sh old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs.sh old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs_with_xalan.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs_with_xalan.sh old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_lastcraft_docs.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_lastcraft_docs.sh old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_phpdoc_docs.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_phpdoc_docs.sh old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/pear_package_create.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/pear_package_create.php old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.ini b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.ini old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/integration.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/integration.php old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/en/synchronisation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/en/synchronisation.xml old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/no-synchronisation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/no-synchronisation.xml old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/synchronisation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/synchronisation.xml old mode 100755 new mode 100644 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_changelogged.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_changelogged.xml old mode 100755 new mode 100644 diff --git a/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Resources/config/assetic.xml b/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Resources/config/assetic.xml index df3cc0b..7d05979 100644 --- a/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Resources/config/assetic.xml +++ b/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Resources/config/assetic.xml @@ -64,11 +64,7 @@ - - - - - + diff --git a/vendor/symfony/symfony/UPGRADE-2.1.md b/vendor/symfony/symfony/UPGRADE-2.1.md index 1b56d12..4112e66 100644 --- a/vendor/symfony/symfony/UPGRADE-2.1.md +++ b/vendor/symfony/symfony/UPGRADE-2.1.md @@ -247,11 +247,10 @@ reasons. It is now not possible anymore to use custom implementations of `FormBuilderInterface` for specific form types. - If you are in such a situation, you can subclass `FormRegistry` instead and override - `resolveType` to return a custom `ResolvedFormTypeInterface` implementation, within - which you can create your own `FormBuilderInterface` implementation. You should - register this custom registry class under the service name "form.registry" in order - to replace the default implementation. + If you are in such a situation, you can implement a custom `ResolvedFormTypeInterface` + where you create your own `FormBuilderInterface` implementation. You also need to + register a custom `ResolvedFormTypeFactoryInterface` implementation under the service + name "form.resolved_type_factory" in order to replace the default implementation. * If you previously inherited from `FieldType`, you should now inherit from `FormType`. You should also set the option `compound` to `false` if your field @@ -1199,8 +1198,8 @@ } ``` - * Core translation messages are changed. Dot is added at the end of each message. - Overwritten core translations should be fixed if any. More info here. + * Core translation messages changed. A dot is added at the end of each message. + Overwritten core translations need to be fixed. * Collections (arrays or instances of `\Traversable`) in properties annotated with `Valid` are not traversed recursively by default anymore. @@ -1353,6 +1352,11 @@ decoded twice before. Note that the `urldecode()` calls have been changed for a single `rawurldecode()` in order to support `+` for input paths. + * Two new parameters have been added to the DIC: `router.request_context.host` + and `router.request_context.scheme`. You can customize them for your + functional tests or for generating urls with the right host and scheme + when your are in the cli context. + ### FrameworkBundle * session options: lifetime, path, domain, secure, httponly were deprecated. diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php index cde6542..6406bb1 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php @@ -312,7 +312,7 @@ class EntityChoiceList extends ObjectChoiceList * * Otherwise a new integer is generated. * - * @param mixed $choice The choice to create an index for + * @param mixed $entity The choice to create an index for * * @return integer|string A unique index containing only ASCII letters, * digits and underscores. @@ -333,7 +333,7 @@ class EntityChoiceList extends ObjectChoiceList * * Otherwise a new integer is generated. * - * @param mixed $choice The choice to create a value for + * @param mixed $entity The choice to create a value for * * @return integer|string A unique value without character limitations. */ diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/EntityChoiceListTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/EntityChoiceListTest.php index 2d8aeed..5d9c747 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/EntityChoiceListTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/EntityChoiceListTest.php @@ -186,8 +186,8 @@ class EntityChoiceListTest extends DoctrineOrmTestCase $this->assertSame(array(1 => $entity1, 2 => $entity2), $choiceList->getChoices()); $this->assertEquals(array( - 'group1' => array(1 => new ChoiceView('1', 'Foo')), - 'group2' => array(2 => new ChoiceView('2', 'Bar')) + 'group1' => array(1 => new ChoiceView($entity1, '1', 'Foo')), + 'group2' => array(2 => new ChoiceView($entity2, '2', 'Bar')) ), $choiceList->getRemainingViews()); } @@ -219,9 +219,9 @@ class EntityChoiceListTest extends DoctrineOrmTestCase $this->assertEquals(array(1 => $item1, 2 => $item2, 3 => $item3, 4 => $item4), $choiceList->getChoices()); $this->assertEquals(array( - 'Group1' => array(1 => new ChoiceView('1', 'Foo'), 2 => new ChoiceView('2', 'Bar')), - 'Group2' => array(3 => new ChoiceView('3', 'Baz')), - 4 => new ChoiceView('4', 'Boo!') + 'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')), + 'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')), + 4 => new ChoiceView($item4, '4', 'Boo!') ), $choiceList->getRemainingViews()); } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index 9bf5358..073336a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -124,7 +124,7 @@ class EntityTypeTest extends TypeTestCase 'property' => 'name' )); - $this->assertEquals(array(1 => new ChoiceView('1', 'Foo'), 2 => new ChoiceView('2', 'Bar')), $field->createView()->vars['choices']); + $this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']); } public function testSetDataToUninitializedEntityWithNonRequiredToString() @@ -140,7 +140,7 @@ class EntityTypeTest extends TypeTestCase 'required' => false, )); - $this->assertEquals(array(1 => new ChoiceView('1', 'Foo'), 2 => new ChoiceView('2', 'Bar')), $field->createView()->vars['choices']); + $this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']); } public function testSetDataToUninitializedEntityWithNonRequiredQueryBuilder() @@ -159,7 +159,7 @@ class EntityTypeTest extends TypeTestCase 'query_builder' => $qb )); - $this->assertEquals(array(1 => new ChoiceView('1', 'Foo'), 2 => new ChoiceView('2', 'Bar')), $field->createView()->vars['choices']); + $this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']); } /** @@ -503,7 +503,7 @@ class EntityTypeTest extends TypeTestCase $field->bind('2'); - $this->assertEquals(array(1 => new ChoiceView('1', 'Foo'), 2 => new ChoiceView('2', 'Bar')), $field->createView()->vars['choices']); + $this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']); $this->assertTrue($field->isSynchronized()); $this->assertSame($entity2, $field->getData()); $this->assertSame('2', $field->getClientData()); @@ -530,9 +530,9 @@ class EntityTypeTest extends TypeTestCase $this->assertSame('2', $field->getClientData()); $this->assertEquals(array( - 'Group1' => array(1 => new ChoiceView('1', 'Foo'), 2 => new ChoiceView('2', 'Bar')), - 'Group2' => array(3 => new ChoiceView('3', 'Baz')), - '4' => new ChoiceView('4', 'Boo!') + 'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')), + 'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')), + '4' => new ChoiceView($item4, '4', 'Boo!') ), $field->createView()->vars['choices']); } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php index 93bb75c..7ae10e7 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php @@ -75,6 +75,7 @@ class UniqueValidatorTest extends DoctrineOrmTestCase ; $refl = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionProperty') ->disableOriginalConstructor() + ->setMethods(array('getValue')) ->getMock() ; $refl diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php b/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php index bc0867a..54fe224 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php @@ -276,7 +276,7 @@ class ModelChoiceList extends ObjectChoiceList * * Otherwise a new integer is generated. * - * @param mixed $choice The choice to create an index for + * @param mixed $model The choice to create an index for * * @return integer|string A unique index containing only ASCII letters, * digits and underscores. @@ -297,7 +297,7 @@ class ModelChoiceList extends ObjectChoiceList * * Otherwise a new integer is generated. * - * @param mixed $choice The choice to create a value for + * @param mixed $model The choice to create a value for * * @return integer|string A unique value without character limitations. */ diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php index 4ff29fb..68f690d 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php @@ -86,8 +86,8 @@ class ModelChoiceListTest extends Propel1TestCase $this->assertSame(array(1 => $item1, 2 => $item2), $choiceList->getChoices()); $this->assertEquals(array( - 'group1' => array(1 => new ChoiceView('1', 'Foo')), - 'group2' => array(2 => new ChoiceView('2', 'Bar')) + 'group1' => array(1 => new ChoiceView($item1, '1', 'Foo')), + 'group2' => array(2 => new ChoiceView($item2, '2', 'Bar')) ), $choiceList->getRemainingViews()); } @@ -113,9 +113,9 @@ class ModelChoiceListTest extends Propel1TestCase $this->assertEquals(array(1 => $item1, 2 => $item2, 3 => $item3, 4 => $item4), $choiceList->getChoices()); $this->assertEquals(array( - 'Group1' => array(1 => new ChoiceView('1', 'Foo'), 2 => new ChoiceView('2', 'Bar')), - 'Group2' => array(3 => new ChoiceView('3', 'Baz')), - 4 => new ChoiceView('4', 'Boo!') + 'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')), + 'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')), + 4 => new ChoiceView($item4, '4', 'Boo!') ), $choiceList->getRemainingViews()); } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php index 8eec7e8..dca1686 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php @@ -32,21 +32,71 @@ class SearchAndRenderBlockNode extends \Twig_Node_Expression_Function $compiler->raw(', \'' . $blockNameSuffix . '\''); if (isset($arguments[1])) { - $compiler->raw(', '); - - // The "label" function allows one extra argument here, the label if ('label' === $blockNameSuffix) { - if (isset($arguments[2])) { - $compiler->subcompile($arguments[2]); - $compiler->raw(' + '); + // The "label" function expects the label in the second and + // the variables in the third argument + $label = $arguments[1]; + $variables = isset($arguments[2]) ? $arguments[2] : null; + $lineno = $label->getLine(); + + if ($label instanceof \Twig_Node_Expression_Constant) { + // If the label argument is given as a constant, we can either + // strip it away if it is empty, or integrate it into the array + // of variables at compile time. + $labelIsExpression = false; + + // Only insert the label into the array if it is not empty + if (!twig_test_empty($label->getAttribute('value'))) { + $originalVariables = $variables; + $variables = new \Twig_Node_Expression_Array(array(), $lineno); + $labelKey = new \Twig_Node_Expression_Constant('label', $lineno); + + if (null !== $originalVariables) { + foreach ($originalVariables->getKeyValuePairs() as $pair) { + // Don't copy the original label attribute over if it exists + if ((string) $labelKey !== (string) $pair['key']) { + $variables->addElement($pair['value'], $pair['key']); + } + } + } + + // Insert the label argument into the array + $variables->addElement($label, $labelKey); + } + } else { + // The label argument is not a constant, but some kind of + // expression. This expression needs to be evaluated at runtime. + // Depending on the result (whether it is null or not), the + // label in the arguments should take precedence over the label + // in the attributes or not. + $labelIsExpression = true; + } + } else { + // All other functions than "label" expect the variables + // in the second argument + $label = null; + $variables = $arguments[1]; + $labelIsExpression = false; + } + + if (null !== $variables || $labelIsExpression) { + $compiler->raw(', '); + + if (null !== $variables) { + $compiler->subcompile($variables); } - // Add the label to the variable array - $compiler->raw('array(\'label\' => '); - $compiler->subcompile($arguments[1]); - $compiler->raw(')'); - } else { - $compiler->subcompile($arguments[1]); + if ($labelIsExpression) { + if (null !== $variables) { + $compiler->raw(' + '); + } + + // Check at runtime whether the label is empty. + // If not, add it to the array at runtime. + $compiler->raw('(twig_test_empty($_label_ = '); + $compiler->subcompile($label); + $compiler->raw(') ? array() : array("label" => $_label_))'); + } } } } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index 3c10d53..0e562e4 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -249,7 +249,7 @@ {% block form_row %} {% spaceless %}
- {{ form_label(form, label|default(null)) }} + {{ form_label(form) }} {{ form_errors(form) }} {{ form_widget(form) }}
diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig index 27f830f..63bd7d2 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig @@ -4,7 +4,7 @@ {% spaceless %} - {{ form_label(form, label|default(null)) }} + {{ form_label(form) }} {{ form_errors(form) }} diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php index 043d8c9..903db69 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php @@ -134,7 +134,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest */ public function testIsChoiceSelected($expected, $choice, $value) { - $choice = new ChoiceView($choice, $choice . ' label'); + $choice = new ChoiceView($choice, $choice, $choice . ' label'); $this->assertSame($expected, $this->extension->isSelectedChoice($choice, $value)); } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php new file mode 100644 index 0000000..c1f247c --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php @@ -0,0 +1,282 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Tests\Node; + +use Symfony\Bridge\Twig\Tests\TestCase; +use Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode; + +class SearchAndRenderBlockNodeTest extends TestCase +{ + protected function setUp() + { + parent::setUp(); + + if (version_compare(\Twig_Environment::VERSION, '1.5.0', '<')) { + $this->markTestSkipped('Requires Twig version to be at least 1.5.0.'); + } + } + + public function testCompileWidget() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + )); + + $node = new SearchAndRenderBlockNode('form_widget', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'widget\')', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + public function testCompileWidgetWithVariables() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + new \Twig_Node_Expression_Array(array( + new \Twig_Node_Expression_Constant('foo', 0), + new \Twig_Node_Expression_Constant('bar', 0), + ), 0), + )); + + $node = new SearchAndRenderBlockNode('form_widget', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'widget\', array("foo" => "bar"))', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + public function testCompileLabelWithLabel() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + new \Twig_Node_Expression_Constant('my label', 0), + )); + + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', array("label" => "my label"))', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + public function testCompileLabelWithNullLabel() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + new \Twig_Node_Expression_Constant(null, 0), + )); + + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + // "label" => null must not be included in the output! + // Otherwise the default label is overwritten with null. + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\')', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + public function testCompileLabelWithEmptyStringLabel() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + new \Twig_Node_Expression_Constant('', 0), + )); + + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + // "label" => null must not be included in the output! + // Otherwise the default label is overwritten with null. + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\')', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + public function testCompileLabelWithDefaultLabel() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + )); + + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\')', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + public function testCompileLabelWithAttributes() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + new \Twig_Node_Expression_Constant(null, 0), + new \Twig_Node_Expression_Array(array( + new \Twig_Node_Expression_Constant('foo', 0), + new \Twig_Node_Expression_Constant('bar', 0), + ), 0), + )); + + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + // "label" => null must not be included in the output! + // Otherwise the default label is overwritten with null. + // https://github.com/symfony/symfony/issues/5029 + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', array("foo" => "bar"))', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + public function testCompileLabelWithLabelAndAttributes() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + new \Twig_Node_Expression_Constant('value in argument', 0), + new \Twig_Node_Expression_Array(array( + new \Twig_Node_Expression_Constant('foo', 0), + new \Twig_Node_Expression_Constant('bar', 0), + new \Twig_Node_Expression_Constant('label', 0), + new \Twig_Node_Expression_Constant('value in attributes', 0), + ), 0), + )); + + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in argument"))', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + public function testCompileLabelWithLabelThatEvaluatesToNull() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + new \Twig_Node_Expression_Conditional( + // if + new \Twig_Node_Expression_Constant(true, 0), + // then + new \Twig_Node_Expression_Constant(null, 0), + // else + new \Twig_Node_Expression_Constant(null, 0), + 0 + ), + )); + + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + // "label" => null must not be included in the output! + // Otherwise the default label is overwritten with null. + // https://github.com/symfony/symfony/issues/5029 + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes() + { + $arguments = new \Twig_Node(array( + new \Twig_Node_Expression_Name('form', 0), + new \Twig_Node_Expression_Conditional( + // if + new \Twig_Node_Expression_Constant(true, 0), + // then + new \Twig_Node_Expression_Constant(null, 0), + // else + new \Twig_Node_Expression_Constant(null, 0), + 0 + ), + new \Twig_Node_Expression_Array(array( + new \Twig_Node_Expression_Constant('foo', 0), + new \Twig_Node_Expression_Constant('bar', 0), + new \Twig_Node_Expression_Constant('label', 0), + new \Twig_Node_Expression_Constant('value in attributes', 0), + ), 0), + )); + + $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); + + $compiler = new \Twig_Compiler(new \Twig_Environment()); + + // "label" => null must not be included in the output! + // Otherwise the default label is overwritten with null. + // https://github.com/symfony/symfony/issues/5029 + $this->assertEquals( + sprintf( + '$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in attributes") + (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))', + $this->getVariableGetter('form') + ), + trim($compiler->compile($node)->getSource()) + ); + } + + protected function getVariableGetter($name) + { + if (version_compare(phpversion(), '5.4.0RC1', '>=')) { + return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); + } + + return sprintf('$this->getContext($context, "%s")', $name); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index bc145a2..0159fbc 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -33,7 +33,7 @@ class AssetsInstallCommand extends ContainerAwareCommand $this ->setName('assets:install') ->setDefinition(array( - new InputArgument('target', InputArgument::REQUIRED, 'The target directory (usually "web")'), + new InputArgument('target', InputArgument::OPTIONAL, 'The target directory', 'web'), )) ->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it') ->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks') diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php index b6d94af..06a0d19 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php @@ -44,7 +44,7 @@ class RegisterKernelListenersPass implements CompilerPassInterface } foreach ($container->findTaggedServiceIds('kernel.event_subscriber') as $id => $attributes) { - // We must assume that the class value has been correcly filled, even if the service is created by a factory + // We must assume that the class value has been correctly filled, even if the service is created by a factory $class = $container->getDefinition($id)->getClass(); $refClass = new \ReflectionClass($class); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php index 523bd17..ddc5994 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php @@ -196,9 +196,10 @@ class HttpKernel extends BaseHttpKernel * * This method uses the "_internal" route, which should be available. * - * @param string $controller A controller name to execute (a string like BlogBundle:Post:index), or a relative URI - * @param array $attributes An array of request attributes - * @param array $query An array of request query parameters + * @param string $controller A controller name to execute (a string like BlogBundle:Post:index), or a relative URI + * @param array $attributes An array of request attributes + * @param array $query An array of request query parameters + * @param boolean $secure * * @return string An internal URI */ @@ -226,6 +227,7 @@ class HttpKernel extends BaseHttpKernel * Renders an HInclude tag. * * @param string $uri A URI + * @param string $defaultContent Default content */ public function renderHIncludeTag($uri, $defaultContent = null) { diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml index 8bef4bc..d2df3eb 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml @@ -5,47 +5,45 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension + Symfony\Component\Form\ResolvedFormTypeFactory Symfony\Component\Form\FormRegistry Symfony\Component\Form\FormFactory + Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser + + + + + - + - + - + @@ -138,6 +136,11 @@ + + + + + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml index d4d181a..ff6c6f5 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml @@ -22,6 +22,8 @@ %kernel.name%%kernel.environment%UrlMatcher %kernel.name%%kernel.environment%UrlGenerator Symfony\Component\HttpKernel\EventListener\RouterListener + localhost + http @@ -74,8 +76,8 @@ GET - localhost - http + %router.request_context.host% + %router.request_context.scheme% %request_listener.http_port% %request_listener.https_port% diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php index 0918070..a4f86d0 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php @@ -1,5 +1,5 @@
- label($form, isset($label) ? $label : null) ?> + label($form) ?> errors($form) ?> widget($form) ?>
diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php index b9e5c56..7e1f2f5 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php @@ -1,6 +1,6 @@ - label($form, isset($label) ? $label : null) ?> + label($form) ?> errors($form) ?> diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php index b8c6a02..e271bc5 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php @@ -125,7 +125,7 @@ class FormHelper extends Helper */ public function label(FormView $view, $label = null, array $variables = array()) { - if ($label !== null) { + if (null !== $label) { $variables += array('label' => $label); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index b5d5a0d..91d52df 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -224,6 +224,25 @@ class ClientTest extends \PHPUnit_Framework_TestCase $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() clicks on links'); } + public function testClickForm() + { + if (!class_exists('Symfony\Component\DomCrawler\Crawler')) { + $this->markTestSkipped('The "DomCrawler" component is not available'); + } + + if (!class_exists('Symfony\Component\CssSelector\CssSelector')) { + $this->markTestSkipped('The "CssSelector" component is not available'); + } + + $client = new TestClient(); + $client->setNextResponse(new Response('
')); + $crawler = $client->request('GET', 'http://www.example.com/foo/foobar'); + + $client->click($crawler->filter('input')->form()); + + $this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() Form submit forms'); + } + public function testSubmit() { if (!class_exists('Symfony\Component\DomCrawler\Crawler')) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php index 218c688..0c077d3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php @@ -144,6 +144,29 @@ class CookieJarTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('foo' => 'bar%3Dbaz'), $cookieJar->allRawValues('/')); } + public function testCookieExpireWithSameNameButDifferentPaths() + { + $cookieJar = new CookieJar(); + $cookieJar->set($cookie1 = new Cookie('foo', 'bar1', null, '/foo')); + $cookieJar->set($cookie2 = new Cookie('foo', 'bar2', null, '/bar')); + $cookieJar->expire('foo', '/foo'); + + $this->assertNull($cookieJar->get('foo'), '->get() returns null if the cookie is expired'); + $this->assertEquals(array(), array_keys($cookieJar->allValues('http://example.com/'))); + $this->assertEquals(array(), $cookieJar->allValues('http://example.com/foo')); + $this->assertEquals(array('foo' => 'bar2'), $cookieJar->allValues('http://example.com/bar')); + } + + public function testCookieExpireWithNullPaths() + { + $cookieJar = new CookieJar(); + $cookieJar->set($cookie1 = new Cookie('foo', 'bar1', null, '/')); + $cookieJar->expire('foo', null); + + $this->assertNull($cookieJar->get('foo'), '->get() returns null if the cookie is expired'); + $this->assertEquals(array(), array_keys($cookieJar->allValues('http://example.com/'))); + } + public function testCookieWithSameNameButDifferentPaths() { $cookieJar = new CookieJar(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/CookieTest.php index fbc493a..2db3ac6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/CookieTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Tests/CookieTest.php @@ -58,6 +58,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase array('foo=bar; expires=Fri, 31 Jul 2020 08:49:37 GMT'), array('foo=bar; expires=Friday, 31-Jul-20 08:49:37 GMT'), array('foo=bar; expires=Fri Jul 31 08:49:37 2020'), + array('foo=bar; expires=\'Fri Jul 31 08:49:37 2020\''), ); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php index 3c298a4..3831d70 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -69,7 +69,7 @@ class ArrayNodeDefinitionTest extends \PHPUnit_Framework_TestCase /** * @expectedException Symfony\Component\Config\Definition\Exception\InvalidDefinitionException */ - public function testPrototypeNodesCantHaveADefaultValueWhenUsingDefaulChildren() + public function testPrototypeNodesCantHaveADefaultValueWhenUsingDefaultChildren() { $node = new ArrayNodeDefinition('root'); $node diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php index 6e7480f..11d20a4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php @@ -200,9 +200,9 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase /** * Assert that the given test builder, will return the given value - * @param mixed $value The value to test - * @param TreeBuilder $test The tree builder to finalize - * @param mixed $config The config values that new to be finalized + * @param mixed $value The value to test + * @param TreeBuilder $treeBuilder The tree builder to finalize + * @param mixed $config The config values that new to be finalized */ protected function assertFinalizedValueIs($value, $treeBuilder, $config=null) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php index ca2b0e6..8afbaf8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php @@ -90,7 +90,7 @@ class TreeBuilderTest extends \PHPUnit_Framework_TestCase ->end(); } - public function testDefinitionInfoGetsTransferedToNode() + public function testDefinitionInfoGetsTransferredToNode() { $builder = new TreeBuilder(); @@ -107,7 +107,7 @@ class TreeBuilderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('child info', $children['child']->getInfo()); } - public function testDefinitionExampleGetsTransferedToNode() + public function testDefinitionExampleGetsTransferredToNode() { $builder = new TreeBuilder(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php index cab5fe5..9fc8518 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php @@ -1041,7 +1041,7 @@ class Application * if nothing is found in $collection, try in $abbrevs * * @param string $name The string - * @param array|Traversable $collection The collecion + * @param array|Traversable $collection The collection * @param array $abbrevs The abbreviations * @param Closure|string|array $callback The callable to transform collection item before comparison * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php index b5a55fe..e8642b3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php @@ -50,7 +50,7 @@ interface OutputFormatterStyleInterface /** * Unsets some specific style option. * - * @param string $option Theoption name + * @param string $option The option name */ public function unsetOption($option); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/ApplicationTest.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/ApplicationTest.php index 9746507..da54d77 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -224,7 +224,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $application->add(new \Foo2Command()); try { - $application->find($commandName = 'Unknow command'); + $application->find($commandName = 'Unknown command'); $this->fail('->find() throws an \InvalidArgumentException if command does not exist'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if command does not exist'); @@ -264,11 +264,11 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $application->add(new \foo3Command()); try { - $application->find('Unknow-namespace:Unknow-command'); + $application->find('Unknown-namespace:Unknown-command'); $this->fail('->find() throws an \InvalidArgumentException if namespace does not exist'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if namespace does not exist'); - $this->assertEquals('There are no commands defined in the "Unknow-namespace" namespace.', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, without alternatives'); + $this->assertEquals('There are no commands defined in the "Unknown-namespace" namespace.', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, without alternatives'); } try { diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index 9e21972..70592df 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -81,7 +81,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface continue; } - if ($this->isInlinableDefinition($container, $id, $definition = $container->getDefinition($id))) { + if ($this->isInlineableDefinition($container, $id, $definition = $container->getDefinition($id))) { $this->compiler->addLogMessage($this->formatter->formatInlineService($this, $id, $this->currentId)); if (ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope()) { @@ -109,7 +109,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface * * @return Boolean If the definition is inlineable */ - private function isInlinableDefinition(ContainerBuilder $container, $id, Definition $definition) + private function isInlineableDefinition(ContainerBuilder $container, $id, Definition $definition) { if (ContainerInterface::SCOPE_PROTOTYPE === $definition->getScope()) { return true; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php b/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php index 8bf81c9..34b0a9b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php @@ -27,9 +27,9 @@ class Filesystem * * By default, if the target already exists, it is not overridden. * - * @param string $originFile The original filename - * @param string $targetFile The target filename - * @param array $override Whether to override an existing file or not + * @param string $originFile The original filename + * @param string $targetFile The target filename + * @param boolean $override Whether to override an existing file or not * * @throws IOException When copy fails */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 3a935e1..94bd716 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -31,7 +31,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->filesystem = new Filesystem(); - $this->workspace = sys_get_temp_dir().DIRECTORY_SEPARATOR.time().rand(0, 1000); + $this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().rand(0, 1000); mkdir($this->workspace, 0777, true); } @@ -319,7 +319,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase mkdir($basePath); mkdir($basePath.'dir'); // create symlink to unexisting file - symlink($basePath.'file', $basePath.'link'); + @symlink($basePath.'file', $basePath.'link'); $this->filesystem->remove($basePath); @@ -388,8 +388,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $this->filesystem->chmod($file, 0400); $this->filesystem->chmod($dir, 0753); - $this->assertEquals(753, $this->getFilePermisions($dir)); - $this->assertEquals(400, $this->getFilePermisions($file)); + $this->assertEquals(753, $this->getFilePermissions($dir)); + $this->assertEquals(400, $this->getFilePermissions($file)); } public function testChmodWrongMod() @@ -414,8 +414,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $this->filesystem->chmod($file, 0400, 0000, true); $this->filesystem->chmod($dir, 0753, 0000, true); - $this->assertEquals(753, $this->getFilePermisions($dir)); - $this->assertEquals(753, $this->getFilePermisions($file)); + $this->assertEquals(753, $this->getFilePermissions($dir)); + $this->assertEquals(753, $this->getFilePermissions($file)); } public function testChmodAppliesUmask() @@ -426,7 +426,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase touch($file); $this->filesystem->chmod($file, 0770, 0022); - $this->assertEquals(750, $this->getFilePermisions($file)); + $this->assertEquals(750, $this->getFilePermissions($file)); } public function testChmodChangesModeOfArrayOfFiles() @@ -442,8 +442,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $this->filesystem->chmod($files, 0753); - $this->assertEquals(753, $this->getFilePermisions($file)); - $this->assertEquals(753, $this->getFilePermisions($directory)); + $this->assertEquals(753, $this->getFilePermissions($file)); + $this->assertEquals(753, $this->getFilePermissions($directory)); } public function testChmodChangesModeOfTraversableFileObject() @@ -459,8 +459,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $this->filesystem->chmod($files, 0753); - $this->assertEquals(753, $this->getFilePermisions($file)); - $this->assertEquals(753, $this->getFilePermisions($directory)); + $this->assertEquals(753, $this->getFilePermissions($file)); + $this->assertEquals(753, $this->getFilePermissions($directory)); } public function testChown() @@ -701,6 +701,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $link1 = $this->workspace.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'link'; $link2 = $this->workspace.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'subdir'.DIRECTORY_SEPARATOR.'link'; + touch($file); + $this->filesystem->symlink($file, $link1); $this->filesystem->symlink($file, $link2); @@ -830,13 +832,15 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase * * @return integer */ - private function getFilePermisions($filePath) + private function getFilePermissions($filePath) { return (int) substr(sprintf('%o', fileperms($filePath)), -3); } private function getFileOwner($filepath) { + $this->markAsSkippedIfPosixIsMissing(); + $infos = stat($filepath); if ($datas = posix_getpwuid($infos['uid'])) { return $datas['name']; @@ -845,6 +849,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase private function getFileGroup($filepath) { + $this->markAsSkippedIfPosixIsMissing(); + $infos = stat($filepath); if ($datas = posix_getgrgid($infos['gid'])) { return $datas['name']; @@ -867,8 +873,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase private function markAsSkippedIfPosixIsMissing() { - if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - $this->markTestSkipped('Posix uids are not available on windows'); + if (defined('PHP_WINDOWS_VERSION_MAJOR') || !function_exists('posix_isatty')) { + $this->markTestSkipped('Posix is not supported'); } } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php index dd870e2..8ff5739 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php @@ -19,7 +19,7 @@ namespace Symfony\Component\Finder\Iterator; * * @author Fabien Potencier */ -class CustomFilterIterator extends \FilterIterator +class CustomFilterIterator extends FilterIterator { private $filters = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php index 8ed17b4..1664793 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php @@ -16,7 +16,7 @@ namespace Symfony\Component\Finder\Iterator; * * @author Fabien Potencier */ -class DateRangeFilterIterator extends \FilterIterator +class DateRangeFilterIterator extends FilterIterator { private $comparators = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php index 7d58c38..8321253 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php @@ -16,7 +16,7 @@ namespace Symfony\Component\Finder\Iterator; * * @author Fabien Potencier */ -class DepthRangeFilterIterator extends \FilterIterator +class DepthRangeFilterIterator extends FilterIterator { private $minDepth = 0; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php index 40759c0..42c8ce7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php @@ -16,7 +16,7 @@ namespace Symfony\Component\Finder\Iterator; * * @author Fabien Potencier */ -class ExcludeDirectoryFilterIterator extends \FilterIterator +class ExcludeDirectoryFilterIterator extends FilterIterator { private $patterns; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php index da62ecf..5b7bbb1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php @@ -16,7 +16,7 @@ namespace Symfony\Component\Finder\Iterator; * * @author Fabien Potencier */ -class FileTypeFilterIterator extends \FilterIterator +class FileTypeFilterIterator extends FilterIterator { const ONLY_FILES = 1; const ONLY_DIRECTORIES = 2; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/FilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/FilterIterator.php new file mode 100644 index 0000000..64da508 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/FilterIterator.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * This iterator just overrides the rewind method in order to correct a PHP bug. + * + * @see https://bugs.php.net/bug.php?id=49104 + * + * @author Alex Bogomazov + */ +abstract class FilterIterator extends \FilterIterator +{ + /** + * This is a workaround for the problem with \FilterIterator leaving inner \FilesystemIterator in wrong state after + * rewind in some cases. + * + * @see FilterIterator::rewind() + */ + public function rewind() + { + $iterator = $this; + while ($iterator instanceof \OuterIterator) { + if ($iterator->getInnerIterator() instanceof \FilesystemIterator) { + $iterator->getInnerIterator()->next(); + $iterator->getInnerIterator()->rewind(); + } + $iterator = $iterator->getInnerIterator(); + } + + parent::rewind(); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php index 42199ab..12584b1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php @@ -16,7 +16,7 @@ namespace Symfony\Component\Finder\Iterator; * * @author Fabien Potencier */ -abstract class MultiplePcreFilterIterator extends \FilterIterator +abstract class MultiplePcreFilterIterator extends FilterIterator { protected $matchRegexps; protected $noMatchRegexps; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php index b9b8044..89a4fc4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php @@ -16,7 +16,7 @@ namespace Symfony\Component\Finder\Iterator; * * @author Fabien Potencier */ -class SizeRangeFilterIterator extends \FilterIterator +class SizeRangeFilterIterator extends FilterIterator { private $comparators = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/FinderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/FinderTest.php index 05ed82f..ec7db1e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -440,4 +440,23 @@ class FinderTest extends Iterator\RealIteratorTestCase $this->assertIterator(array(), $finder); } + /** + * Searching in multiple locations involves AppendIterator which does an unnecessary rewind which leaves FilterIterator + * with inner FilesystemIterator in an ivalid state. + * + * @see https://bugs.php.net/bug.php?id=49104 + */ + public function testMultipleLocations() + { + $locations = array( + self::$tmpDir.'/', + self::$tmpDir.'/toto/', + ); + + // it is expected that there are test.py test.php in the tmpDir + $finder = new Finder(); + $finder->in($locations)->depth('< 1')->name('test.php'); + + $this->assertEquals(1, count($finder)); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php index f80e6a5..5f0625f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php @@ -165,12 +165,10 @@ class MockSplFileInfo extends \SplFileInfo if (is_string($type)) { switch ($type) { case 'directory': - $this->type = self::TYPE_DIRECTORY; case 'd': $this->type = self::TYPE_DIRECTORY; break; case 'file': - $this->type = self::TYPE_FILE; case 'f': $this->type = self::TYPE_FILE; break; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php new file mode 100644 index 0000000..f42a62a --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +/** + * @author Alex Bogomazov + */ +class FilterIteratorTest extends RealIteratorTestCase +{ + public function testFilterFilesystemIterators() + { + $i = new \FilesystemIterator(sys_get_temp_dir().'/symfony2_finder'); + + // it is expected that there are test.py test.php in the tmpDir + $i = $this->getMockForAbstractClass('Symfony\Component\Finder\Iterator\FilterIterator', array($i)); + $i->expects($this->any()) + ->method('accept') + ->will($this->returnCallback(function () use ($i) { + return (bool) preg_match('/\.php/', (string) $i->current()); + }) + ); + + $c = 0; + foreach ($i as $item) { + $c++; + } + + $this->assertEquals(1, $c); + + $i->rewind(); + + $c = 0; + foreach ($i as $item) { + $c++; + } + + // This would fail with \FilterIterator but works with Symfony\Component\Finder\Iterator\FilterIterator + // see https://bugs.php.net/bug.php?id=49104 + $this->assertEquals(1, $c); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/AbstractRendererEngine.php b/vendor/symfony/symfony/src/Symfony/Component/Form/AbstractRendererEngine.php index 5d7416d..9e16b44 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/AbstractRendererEngine.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/AbstractRendererEngine.php @@ -21,7 +21,7 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface /** * The variable in {@link FormView} used as cache key. */ - const CACHE_KEY_VAR = 'full_block_name'; + const CACHE_KEY_VAR = 'cache_key'; /** * @var array diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md index 5d5a472..1e3a60f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md @@ -152,12 +152,12 @@ CHANGELOG * deprecated the options "data_timezone" and "user_timezone" in DateType, DateTimeType and TimeType and renamed them to "model_timezone" and "view_timezone" * fixed: TransformationFailedExceptions thrown in the model transformer are now caught by the form - * added FormRegistry and ResolvedFormTypeInterface + * added FormRegistryInterface, ResolvedFormTypeInterface and ResolvedFormTypeFactoryInterface * deprecated FormFactory methods * `addType` * `hasType` * `getType` - * [BC BREAK] FormFactory now expects a FormRegistryInterface as constructor argument + * [BC BREAK] FormFactory now expects a FormRegistryInterface and a ResolvedFormTypeFactoryInterface as constructor argument * [BC BREAK] The method `createBuilder` in FormTypeInterface is not supported anymore for performance reasons * [BC BREAK] Removed `setTypes` from FormBuilder * deprecated AbstractType methods @@ -175,3 +175,5 @@ CHANGELOG * `isChoiceSelected` * [BC BREAK] renamed method `renderBlock` in FormHelper to `block` and changed its signature * made FormView properties public and deprecated their accessor methods + * made the normalized data of a form accessible in the template through the variable "form.vars.data" + * made the original data of a choice accessible in the template through the property "choice.data" diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php index 4059757..fcccfdd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Form\Extension\Core\ChoiceList; -use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormConfigBuilder; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Exception\InvalidConfigurationException; use Symfony\Component\Form\Extension\Core\View\ChoiceView; @@ -20,7 +20,10 @@ use Symfony\Component\Form\Extension\Core\View\ChoiceView; * A choice list for choices of arbitrary data types. * * Choices and labels are passed in two arrays. The indices of the choices - * and the labels should match. + * and the labels should match. Choices may also be given as hierarchy of + * unlimited depth by creating nested arrays. The title of the sub-hierarchy + * can be stored in the array key pointing to the nested array. The topmost + * level of the hierarchy may also be a \Traversable. * * * $choices = array(true, false); @@ -66,17 +69,24 @@ class ChoiceList implements ChoiceListInterface * Creates a new choice list. * * @param array|\Traversable $choices The array of choices. Choices may also be given - * as hierarchy of unlimited depth. Hierarchies are - * created by creating nested arrays. The title of - * the sub-hierarchy can be stored in the array - * key pointing to the nested array. + * as hierarchy of unlimited depth. Hierarchies are + * created by creating nested arrays. The title of + * the sub-hierarchy can be stored in the array + * key pointing to the nested array. The topmost + * level of the hierarchy may also be a \Traversable. * @param array $labels The array of labels. The structure of this array - * should match the structure of $choices. + * should match the structure of $choices. * @param array $preferredChoices A flat array of choices that should be - * presented to the user with priority. + * presented to the user with priority. + * + * @throws UnexpectedTypeException If the choices are not an array or \Traversable. */ public function __construct($choices, array $labels, array $preferredChoices = array()) { + if (!is_array($choices) && !$choices instanceof \Traversable) { + throw new UnexpectedTypeException($choices, 'array or \Traversable'); + } + $this->initialize($choices, $labels, $preferredChoices); } @@ -236,22 +246,25 @@ class ChoiceList implements ChoiceListInterface /** * Recursively adds the given choices to the list. * - * @param array $bucketForPreferred The bucket where to store the preferred - * view objects. - * @param array $bucketForRemaining The bucket where to store the - * non-preferred view objects. - * @param array $choices The list of choices. - * @param array $labels The labels corresponding to the choices. - * @param array $preferredChoices The preferred choices. + * @param array $bucketForPreferred The bucket where to store the preferred + * view objects. + * @param array $bucketForRemaining The bucket where to store the + * non-preferred view objects. + * @param array|\Traversable $choices The list of choices. + * @param array $labels The labels corresponding to the choices. + * @param array $preferredChoices The preferred choices. * - * @throws UnexpectedTypeException If the structure of the $labels array - * does not match the structure of the - * $choices array. + * @throws \InvalidArgumentException If the structures of the choices and labels array do not match. + * @throws InvalidConfigurationException If no valid value or index could be created for a choice. */ - protected function addChoices(&$bucketForPreferred, &$bucketForRemaining, array $choices, array $labels, array $preferredChoices) + protected function addChoices(array &$bucketForPreferred, array &$bucketForRemaining, $choices, array $labels, array $preferredChoices) { // Add choices to the nested buckets foreach ($choices as $group => $choice) { + if (!isset($labels[$group])) { + throw new \InvalidArgumentException('The structures of the choices and labels array do not match.'); + } + if (is_array($choice)) { // Don't do the work if the array is empty if (count($choice) > 0) { @@ -281,14 +294,16 @@ class ChoiceList implements ChoiceListInterface * * @param string $group The name of the group. * @param array $bucketForPreferred The bucket where to store the preferred - * view objects. - * @param array $bucketForRemaining The bucket where to store the - * non-preferred view objects. - * @param array $choices The list of choices in the group. - * @param array $labels The labels corresponding to the choices in the group. - * @param array $preferredChoices The preferred choices. + * view objects. + * @param array $bucketForRemaining The bucket where to store the + * non-preferred view objects. + * @param array $choices The list of choices in the group. + * @param array $labels The labels corresponding to the choices in the group. + * @param array $preferredChoices The preferred choices. + * + * @throws InvalidConfigurationException If no valid value or index could be created for a choice. */ - protected function addChoiceGroup($group, &$bucketForPreferred, &$bucketForRemaining, array $choices, array $labels, array $preferredChoices) + protected function addChoiceGroup($group, array &$bucketForPreferred, array &$bucketForRemaining, array $choices, array $labels, array $preferredChoices) { // If this is a choice group, create a new level in the choice // key hierarchy @@ -325,11 +340,11 @@ class ChoiceList implements ChoiceListInterface * * @throws InvalidConfigurationException If no valid value or index could be created. */ - protected function addChoice(&$bucketForPreferred, &$bucketForRemaining, $choice, $label, array $preferredChoices) + protected function addChoice(array &$bucketForPreferred, array &$bucketForRemaining, $choice, $label, array $preferredChoices) { $index = $this->createIndex($choice); - if ('' === $index || null === $index || !FormConfig::isValidName((string) $index)) { + if ('' === $index || null === $index || !FormConfigBuilder::isValidName((string) $index)) { throw new InvalidConfigurationException('The index "' . $index . '" created by the choice list is invalid. It should be a valid, non-empty Form name.'); } @@ -339,7 +354,7 @@ class ChoiceList implements ChoiceListInterface throw new InvalidConfigurationException('The value created by the choice list is of type "' . gettype($value) . '", but should be a string.'); } - $view = new ChoiceView($value, $label); + $view = new ChoiceView($choice, $value, $label); $this->choices[$index] = $this->fixChoice($choice); $this->values[$index] = $value; @@ -481,7 +496,7 @@ class ChoiceList implements ChoiceListInterface /** * Fixes the data type of the given choices to avoid comparison problems. * - * @param array $choice The choices. + * @param array $choices The choices. * * @return array The fixed choices. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php index 2e08081..eeb6b64 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php @@ -13,7 +13,6 @@ namespace Symfony\Component\Form\Extension\Core\ChoiceList; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\Form\Exception\StringCastException; -use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Exception\InvalidPropertyException; /** @@ -57,11 +56,12 @@ class ObjectChoiceList extends ChoiceList /** * Creates a new object choice list. * - * @param array $choices The array of choices. Choices may also be given - * as hierarchy of unlimited depth. Hierarchies are - * created by creating nested arrays. The title of - * the sub-hierarchy can be stored in the array - * key pointing to the nested array. + * @param array|\Traversable $choices The array of choices. Choices may also be given + * as hierarchy of unlimited depth by creating nested + * arrays. The title of the sub-hierarchy can be + * stored in the array key pointing to the nested + * array. The topmost level of the hierarchy may also + * be a \Traversable. * @param string $labelPath A property path pointing to the property used * for the choice labels. The value is obtained * by calling the getter on the object. If the @@ -78,9 +78,9 @@ class ObjectChoiceList extends ChoiceList */ public function __construct($choices, $labelPath = null, array $preferredChoices = array(), $groupPath = null, $valuePath = null) { - $this->labelPath = $labelPath ? new PropertyPath($labelPath) : null; - $this->groupPath = $groupPath ? new PropertyPath($groupPath) : null; - $this->valuePath = $valuePath ? new PropertyPath($valuePath) : null; + $this->labelPath = null !== $labelPath ? new PropertyPath($labelPath) : null; + $this->groupPath = null !== $groupPath ? new PropertyPath($groupPath) : null; + $this->valuePath = null !== $valuePath ? new PropertyPath($valuePath) : null; parent::__construct($choices, array(), $preferredChoices); } @@ -93,19 +93,18 @@ class ObjectChoiceList extends ChoiceList * @param array|\Traversable $choices The choices to write into the list. * @param array $labels Ignored. * @param array $preferredChoices The choices to display with priority. + * + * @throws \InvalidArgumentException When passing a hierarchy of choices and using + * the "groupPath" option at the same time. */ protected function initialize($choices, array $labels, array $preferredChoices) { - if (!is_array($choices) && !$choices instanceof \Traversable) { - throw new UnexpectedTypeException($choices, 'array or \Traversable'); - } - if (null !== $this->groupPath) { $groupedChoices = array(); foreach ($choices as $i => $choice) { if (is_array($choice)) { - throw new \InvalidArgumentException('You should pass a plain object array (without groups, $code, $previous) when using the "groupPath" option'); + throw new \InvalidArgumentException('You should pass a plain object array (without groups) when using the "groupPath" option.'); } try { @@ -142,10 +141,10 @@ class ObjectChoiceList extends ChoiceList * * If a property path for the value was given at object creation, * the getter behind that path is now called to obtain a new value. - * * Otherwise a new integer is generated. * * @param mixed $choice The choice to create a value for + * * @return integer|string A unique value without character limitations. */ protected function createValue($choice) @@ -160,7 +159,7 @@ class ObjectChoiceList extends ChoiceList private function extractLabels($choices, array &$labels) { foreach ($choices as $i => $choice) { - if (is_array($choice) || $choice instanceof \Traversable) { + if (is_array($choice)) { $labels[$i] = array(); $this->extractLabels($choice, $labels[$i]); } elseif ($this->labelPath) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php index 3e76900..914dbe5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php @@ -11,14 +11,14 @@ namespace Symfony\Component\Form\Extension\Core\ChoiceList; -use Symfony\Component\Form\Exception\UnexpectedTypeException; - /** * A choice list for choices of type string or integer. * * Choices and their associated labels can be passed in a single array. Since * choices are passed as array keys, only strings or integer choices are - * allowed. + * allowed. Choices may also be given as hierarchy of unlimited depth by + * creating nested arrays. The title of the sub-hierarchy can be stored in the + * array key pointing to the nested array. * * * $choiceList = new SimpleChoiceList(array( @@ -35,13 +35,12 @@ class SimpleChoiceList extends ChoiceList * Creates a new simple choice list. * * @param array $choices The array of choices with the choices as keys and - * the labels as values. Choices may also be given - * as hierarchy of unlimited depth. Hierarchies are - * created by creating nested arrays. The title of - * the sub-hierarchy is stored in the array - * key pointing to the nested array. + * the labels as values. Choices may also be given + * as hierarchy of unlimited depth by creating nested + * arrays. The title of the sub-hierarchy is stored + * in the array key pointing to the nested array. * @param array $preferredChoices A flat array of choices that should be - * presented to the user with priority. + * presented to the user with priority. */ public function __construct(array $choices, array $preferredChoices = array()) { @@ -79,17 +78,15 @@ class SimpleChoiceList extends ChoiceList * Takes care of splitting the single $choices array passed in the * constructor into choices and labels. * - * @param array $bucketForPreferred - * @param array $bucketForRemaining - * @param array $choices - * @param array $labels - * @param array $preferredChoices - * - * @throws UnexpectedTypeException - * - * @see parent::addChoices + * @param array $bucketForPreferred The bucket where to store the preferred + * view objects. + * @param array $bucketForRemaining The bucket where to store the + * non-preferred view objects. + * @param array|\Traversable $choices The list of choices. + * @param array $labels Ignored. + * @param array $preferredChoices The preferred choices. */ - protected function addChoices(&$bucketForPreferred, &$bucketForRemaining, array $choices, array $labels, array $preferredChoices) + protected function addChoices(array &$bucketForPreferred, array &$bucketForRemaining, $choices, array $labels, array $preferredChoices) { // Add choices to the nested buckets foreach ($choices as $choice => $label) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/CoreExtension.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/CoreExtension.php index e57a5b2..f0f0d18 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/CoreExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/CoreExtension.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form\Extension\Core; -use Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractExtension; /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php index 724830e..9dfa8af 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php @@ -17,7 +17,6 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormView; -use Symfony\Component\Form\Extension\Core\EventListener\BindRequestListener; use Symfony\Component\Form\Extension\Core\EventListener\TrimListener; use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper; use Symfony\Component\Form\Exception\FormException; @@ -45,7 +44,6 @@ class FormType extends AbstractType ->setData(isset($options['data']) ? $options['data'] : null) ->setDataLocked(isset($options['data'])) ->setDataMapper($options['compound'] ? new PropertyPathMapper() : null) - ->addEventSubscriber(new BindRequestListener()) ; if ($options['trim']) { @@ -71,11 +69,11 @@ class FormType extends AbstractType if ('' !== ($parentFullName = $view->parent->vars['full_name'])) { $id = sprintf('%s_%s', $view->parent->vars['id'], $name); $fullName = sprintf('%s[%s]', $parentFullName, $name); - $fullBlockName = sprintf('%s_%s', $view->parent->vars['full_block_name'], $blockName); + $uniqueBlockPrefix = sprintf('%s_%s', $view->parent->vars['unique_block_prefix'], $blockName); } else { $id = $name; $fullName = $name; - $fullBlockName = '_' . $blockName; + $uniqueBlockPrefix = '_' . $blockName; } // Complex fields are read-only if they themselves or their parents are. @@ -89,7 +87,7 @@ class FormType extends AbstractType } else { $id = $name; $fullName = $name; - $fullBlockName = '_' . $blockName; + $uniqueBlockPrefix = '_' . $blockName; // Strip leading underscores and digits. These are allowed in // form names, but not in HTML4 ID attributes. @@ -97,37 +95,46 @@ class FormType extends AbstractType $id = ltrim($id, '_0123456789'); } - $types = array(); + $blockPrefixes = array(); for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) { - array_unshift($types, $type->getName()); + array_unshift($blockPrefixes, $type->getName()); } + $blockPrefixes[] = $uniqueBlockPrefix; if (!$translationDomain) { $translationDomain = 'messages'; } $view->vars = array_replace($view->vars, array( - 'form' => $view, - 'id' => $id, - 'name' => $name, - 'full_name' => $fullName, - 'full_block_name' => $fullBlockName, - 'read_only' => $readOnly, - 'errors' => $form->getErrors(), - 'valid' => $form->isBound() ? $form->isValid() : true, - 'value' => $form->getViewData(), - 'disabled' => $form->isDisabled(), - 'required' => $form->isRequired(), - 'max_length' => $options['max_length'], - 'pattern' => $options['pattern'], - 'size' => null, - 'label' => $options['label'], - 'multipart' => false, - 'attr' => $options['attr'], - 'label_attr' => $options['label_attr'], - 'compound' => $form->getConfig()->getCompound(), - 'types' => $types, - 'translation_domain' => $translationDomain, + 'form' => $view, + 'id' => $id, + 'name' => $name, + 'full_name' => $fullName, + 'read_only' => $readOnly, + 'errors' => $form->getErrors(), + 'valid' => $form->isBound() ? $form->isValid() : true, + 'value' => $form->getViewData(), + 'data' => $form->getNormData(), + 'disabled' => $form->isDisabled(), + 'required' => $form->isRequired(), + 'max_length' => $options['max_length'], + 'pattern' => $options['pattern'], + 'size' => null, + 'label' => $options['label'], + 'multipart' => false, + 'attr' => $options['attr'], + 'label_attr' => $options['label_attr'], + 'compound' => $form->getConfig()->getCompound(), + 'block_prefixes' => $blockPrefixes, + 'unique_block_prefix' => $uniqueBlockPrefix, + 'translation_domain' => $translationDomain, + // Using the block name here speeds up performance in collection + // forms, where each entry has the same full block name. + // Including the type is important too, because if rows of a + // collection form have different types (dynamically), they should + // be rendered differently. + // https://github.com/symfony/symfony/issues/5038 + 'cache_key' => $uniqueBlockPrefix . '_' . $form->getConfig()->getType()->getName(), )); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/View/ChoiceView.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/View/ChoiceView.php index 0f7d176..5b348ea 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/View/ChoiceView.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/View/ChoiceView.php @@ -18,6 +18,13 @@ namespace Symfony\Component\Form\Extension\Core\View; */ class ChoiceView { + /** + * The original choice value. + * + * @var mixed + */ + public $data; + /** * The view representation of the choice. * @@ -35,11 +42,13 @@ class ChoiceView /** * Creates a new ChoiceView. * + * @param mixed $data The original choice. * @param string $value The view representation of the choice. * @param string $label The label displayed to humans. */ - public function __construct($value, $label) + public function __construct($data, $value, $label) { + $this->data = $data; $this->value = $value; $this->label = $label; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php index 5d25007..bf0c873 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php @@ -56,8 +56,9 @@ class FormTypeCsrfExtension extends AbstractTypeExtension /** * Adds a CSRF field to the root form view. * - * @param FormView $view The form view - * @param FormInterface $form The form + * @param FormView $view The form view + * @param FormInterface $form The form + * @param array $options The options */ public function finishView(FormView $view, FormInterface $form, array $options) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php similarity index 97% rename from vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php rename to vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php index 868a5ae..1c019fc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Form\Extension\Core\EventListener; +namespace Symfony\Component\Form\Extension\HttpFoundation\EventListener; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvent; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php new file mode 100644 index 0000000..3c440a6 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\HttpFoundation; + +use Symfony\Component\Form\AbstractExtension; + +/** + * Integrates the HttpFoundation component with the Form library. + * + * @author Bernhard Schussek + */ +class HttpFoundationExtension extends AbstractExtension +{ + protected function loadTypes() + { + return array( + new Type\FormTypeHttpFoundationExtension(), + ); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php new file mode 100644 index 0000000..27a1831 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\HttpFoundation\Type; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolverInterface; + +/** + * @author Bernhard Schussek + */ +class FormTypeHttpFoundationExtension extends AbstractTypeExtension +{ + /** + * @var BindRequestListener + */ + private $listener; + + public function __construct() + { + $this->listener = new BindRequestListener(); + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->addEventSubscriber($this->listener); + } + + /** + * {@inheritdoc} + */ + public function getExtendedType() + { + return 'form'; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php index 9b755e1..6aa2da1 100755 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php @@ -125,10 +125,10 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface return new TypeGuess('country', array(), Guess::HIGH_CONFIDENCE); case 'Symfony\Component\Validator\Constraints\Date': - return new TypeGuess('date', array('type' => 'string'), Guess::HIGH_CONFIDENCE); + return new TypeGuess('date', array('input' => 'string'), Guess::HIGH_CONFIDENCE); case 'Symfony\Component\Validator\Constraints\DateTime': - return new TypeGuess('datetime', array('type' => 'string'), Guess::HIGH_CONFIDENCE); + return new TypeGuess('datetime', array('input' => 'string'), Guess::HIGH_CONFIDENCE); case 'Symfony\Component\Validator\Constraints\Email': return new TypeGuess('email', array(), Guess::HIGH_CONFIDENCE); @@ -144,7 +144,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface return new TypeGuess('locale', array(), Guess::HIGH_CONFIDENCE); case 'Symfony\Component\Validator\Constraints\Time': - return new TypeGuess('time', array('type' => 'string'), Guess::HIGH_CONFIDENCE); + return new TypeGuess('time', array('input' => 'string'), Guess::HIGH_CONFIDENCE); case 'Symfony\Component\Validator\Constraints\Url': return new TypeGuess('url', array(), Guess::HIGH_CONFIDENCE); @@ -157,7 +157,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface case 'Symfony\Component\Validator\Constraints\Regex': return new TypeGuess('text', array(), Guess::LOW_CONFIDENCE); - case 'Symfony\Component\Validator\Constraints\Size': case 'Symfony\Component\Validator\Constraints\Min': case 'Symfony\Component\Validator\Constraints\Max': return new TypeGuess('number', array(), Guess::LOW_CONFIDENCE); @@ -220,9 +219,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface case 'Symfony\Component\Validator\Constraints\Max': return new ValueGuess(strlen((string) $constraint->limit), Guess::LOW_CONFIDENCE); - - case 'Symfony\Component\Validator\Constraints\Size': - return new ValueGuess(strlen((string) $constraint->max), Guess::LOW_CONFIDENCE); } return null; @@ -252,9 +248,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface case 'Symfony\Component\Validator\Constraints\Min': return new ValueGuess(sprintf('.{%s,}', strlen((string) $constraint->limit)), Guess::LOW_CONFIDENCE); - case 'Symfony\Component\Validator\Constraints\Size': - return new ValueGuess(sprintf('.{%s,%s}', strlen((string) $constraint->min), strlen((string) $constraint->max)), Guess::LOW_CONFIDENCE); - case 'Symfony\Component\Validator\Constraints\Type': if (in_array($constraint->type, array('double', 'float', 'numeric', 'real'))) { return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE); @@ -269,12 +262,12 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface * Iterates over the constraints of a property, executes a constraints on * them and returns the best guess * - * @param string $class The class to read the constraints from - * @param string $property The property for which to find constraints - * @param \Closure $closure The closure that returns a guess - * for a given constraint - * @param mixed $default The default value assumed if no other value - * can be guessed. + * @param string $class The class to read the constraints from + * @param string $property The property for which to find constraints + * @param \Closure $closure The closure that returns a guess + * for a given constraint + * @param mixed $defaultValue The default value assumed if no other value + * can be guessed. * * @return Guess The guessed value with the highest confidence */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php index 1cb5609..e9cf205 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php @@ -146,10 +146,6 @@ class Form implements \IteratorAggregate, FormInterface */ public function __construct(FormConfigInterface $config) { - if (!$config instanceof ImmutableFormConfig) { - $config = new ImmutableFormConfig($config); - } - // Compound forms always need a data mapper, otherwise calls to // `setData` and `add` will not lead to the correct population of // the child forms. @@ -170,7 +166,7 @@ class Form implements \IteratorAggregate, FormInterface /** * Returns the configuration of the form. * - * @return ImmutableFormConfig The form's immutable configuration. + * @return FormConfigInterface The form's configuration. */ public function getConfig() { @@ -372,13 +368,16 @@ class Form implements \IteratorAggregate, FormInterface } $this->lockSetData = true; + $dispatcher = $this->config->getEventDispatcher(); // Hook to change content of the data - $event = new FormEvent($this, $modelData); - $this->config->getEventDispatcher()->dispatch(FormEvents::PRE_SET_DATA, $event); - // BC until 2.3 - $this->config->getEventDispatcher()->dispatch(FormEvents::SET_DATA, $event); - $modelData = $event->getData(); + if ($dispatcher->hasListeners(FormEvents::PRE_SET_DATA) || $dispatcher->hasListeners(FormEvents::SET_DATA)) { + $event = new FormEvent($this, $modelData); + $dispatcher->dispatch(FormEvents::PRE_SET_DATA, $event); + // BC until 2.3 + $dispatcher->dispatch(FormEvents::SET_DATA, $event); + $modelData = $event->getData(); + } // Treat data as strings unless a value transformer exists if (!$this->config->getViewTransformers() && !$this->config->getModelTransformers() && is_scalar($modelData)) { @@ -432,8 +431,10 @@ class Form implements \IteratorAggregate, FormInterface $this->config->getDataMapper()->mapDataToForms($viewData, $this->children); } - $event = new FormEvent($this, $modelData); - $this->config->getEventDispatcher()->dispatch(FormEvents::POST_SET_DATA, $event); + if ($dispatcher->hasListeners(FormEvents::POST_SET_DATA)) { + $event = new FormEvent($this, $modelData); + $dispatcher->dispatch(FormEvents::POST_SET_DATA, $event); + } return $this; } @@ -526,6 +527,13 @@ class Form implements \IteratorAggregate, FormInterface return $this; } + // The data must be initialized if it was not initialized yet. + // This is necessary to guarantee that the *_SET_DATA listeners + // are always invoked before bind() takes place. + if (!$this->initialized) { + $this->setData($this->config->getData()); + } + // Don't convert NULL to a string here in order to determine later // whether an empty value has been submitted or whether no value has // been submitted at all. This is important for processing checkboxes @@ -542,13 +550,16 @@ class Form implements \IteratorAggregate, FormInterface $normData = null; $extraData = array(); $synchronized = false; + $dispatcher = $this->config->getEventDispatcher(); // Hook to change content of the data bound by the browser - $event = new FormEvent($this, $submittedData); - $this->config->getEventDispatcher()->dispatch(FormEvents::PRE_BIND, $event); - // BC until 2.3 - $this->config->getEventDispatcher()->dispatch(FormEvents::BIND_CLIENT_DATA, $event); - $submittedData = $event->getData(); + if ($dispatcher->hasListeners(FormEvents::PRE_BIND) || $dispatcher->hasListeners(FormEvents::BIND_CLIENT_DATA)) { + $event = new FormEvent($this, $submittedData); + $dispatcher->dispatch(FormEvents::PRE_BIND, $event); + // BC until 2.3 + $dispatcher->dispatch(FormEvents::BIND_CLIENT_DATA, $event); + $submittedData = $event->getData(); + } // By default, the submitted data is also the data in view format $viewData = $submittedData; @@ -610,11 +621,13 @@ class Form implements \IteratorAggregate, FormInterface // Hook to change content of the data into the normalized // representation - $event = new FormEvent($this, $normData); - $this->config->getEventDispatcher()->dispatch(FormEvents::BIND, $event); - // BC until 2.3 - $this->config->getEventDispatcher()->dispatch(FormEvents::BIND_NORM_DATA, $event); - $normData = $event->getData(); + if ($dispatcher->hasListeners(FormEvents::BIND) || $dispatcher->hasListeners(FormEvents::BIND_NORM_DATA)) { + $event = new FormEvent($this, $normData); + $dispatcher->dispatch(FormEvents::BIND, $event); + // BC until 2.3 + $dispatcher->dispatch(FormEvents::BIND_NORM_DATA, $event); + $normData = $event->getData(); + } // Synchronize representations - must not change the content! $modelData = $this->normToModel($normData); @@ -630,10 +643,11 @@ class Form implements \IteratorAggregate, FormInterface $this->viewData = $viewData; $this->extraData = $extraData; $this->synchronized = $synchronized; - $this->initialized = true; - $event = new FormEvent($this, $viewData); - $this->config->getEventDispatcher()->dispatch(FormEvents::POST_BIND, $event); + if ($dispatcher->hasListeners(FormEvents::POST_BIND)) { + $event = new FormEvent($this, $viewData); + $dispatcher->dispatch(FormEvents::POST_BIND, $event); + } foreach ($this->config->getValidators() as $validator) { $validator->validate($this); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php index 4abec18..e89cdfd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php @@ -20,7 +20,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; * * @author Bernhard Schussek */ -class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderInterface +class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormBuilderInterface { /** * The form factory. @@ -56,6 +56,7 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI * @param string $dataClass * @param EventDispatcherInterface $dispatcher * @param FormFactoryInterface $factory + * @param array $options */ public function __construct($name, $dataClass, EventDispatcherInterface $dispatcher, FormFactoryInterface $factory, array $options = array()) { @@ -77,6 +78,10 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI */ public function add($child, $type = null, array $options = array()) { + if ($this->locked) { + throw new FormException('The form builder cannot be modified anymore.'); + } + if ($child instanceof self) { $child->setParent($this); $this->children[$child->getName()] = $child; @@ -110,6 +115,10 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI */ public function create($name, $type = null, array $options = array()) { + if ($this->locked) { + throw new FormException('The form builder cannot be modified anymore.'); + } + if (null === $type && null === $this->getDataClass()) { $type = 'text'; } @@ -142,6 +151,10 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI */ public function remove($name) { + if ($this->locked) { + throw new FormException('The form builder cannot be modified anymore.'); + } + unset($this->unresolvedChildren[$name]); if (array_key_exists($name, $this->children)) { @@ -195,7 +208,7 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI { $this->resolveChildren(); - $form = new Form($this); + $form = new Form($this->getFormConfig()); foreach ($this->children as $child) { $form->add($child->getForm()); @@ -217,6 +230,10 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI */ public function setParent(FormBuilderInterface $parent = null) { + if ($this->locked) { + throw new FormException('The form builder cannot be modified anymore.'); + } + $this->parent = $parent; return $this; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilderInterface.php index bc8eee1..034a65a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilderInterface.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Form; /** * @author Bernhard Schussek */ -interface FormBuilderInterface extends FormConfigEditorInterface, \Traversable, \Countable +interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuilderInterface { /** * Adds a new field to this group. A field must have a unique name within diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigBuilder.php similarity index 76% rename from vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php rename to vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigBuilder.php index af68a13..81906fe 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigBuilder.php @@ -11,18 +11,25 @@ namespace Symfony\Component\Form; +use Symfony\Component\Form\Exception\FormException; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\EventDispatcher\ImmutableEventDispatcher; /** * A basic form configuration. * * @author Bernhard Schussek */ -class FormConfig implements FormConfigEditorInterface +class FormConfigBuilder implements FormConfigBuilderInterface { + /** + * @var Boolean + */ + protected $locked = false; + /** * @var EventDispatcherInterface */ @@ -161,6 +168,10 @@ class FormConfig implements FormConfigEditorInterface */ public function addEventListener($eventName, $listener, $priority = 0) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->dispatcher->addListener($eventName, $listener, $priority); return $this; @@ -171,6 +182,10 @@ class FormConfig implements FormConfigEditorInterface */ public function addEventSubscriber(EventSubscriberInterface $subscriber) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->dispatcher->addSubscriber($subscriber); return $this; @@ -181,6 +196,10 @@ class FormConfig implements FormConfigEditorInterface */ public function addValidator(FormValidatorInterface $validator) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->validators[] = $validator; return $this; @@ -191,6 +210,10 @@ class FormConfig implements FormConfigEditorInterface */ public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + if ($forcePrepend) { array_unshift($this->viewTransformers, $viewTransformer); } else { @@ -205,6 +228,10 @@ class FormConfig implements FormConfigEditorInterface */ public function resetViewTransformers() { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->viewTransformers = array(); return $this; @@ -215,13 +242,17 @@ class FormConfig implements FormConfigEditorInterface * * @param DataTransformerInterface $viewTransformer * - * @return self The configuration object. + * @return FormConfigBuilder The configuration object. * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use * {@link addViewTransformer()} instead. */ public function appendClientTransformer(DataTransformerInterface $viewTransformer) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + return $this->addViewTransformer($viewTransformer); } @@ -230,25 +261,33 @@ class FormConfig implements FormConfigEditorInterface * * @param DataTransformerInterface $viewTransformer * - * @return self The configuration object. + * @return FormConfigBuilder The configuration object. * * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ public function prependClientTransformer(DataTransformerInterface $viewTransformer) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + return $this->addViewTransformer($viewTransformer, true); } /** * Alias of {@link resetViewTransformers()}. * - * @return self The configuration object. + * @return FormConfigBuilder The configuration object. * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use * {@link resetViewTransformers()} instead. */ public function resetClientTransformers() { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + return $this->resetViewTransformers(); } @@ -257,6 +296,10 @@ class FormConfig implements FormConfigEditorInterface */ public function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + if ($forceAppend) { $this->modelTransformers[] = $modelTransformer; } else { @@ -271,6 +314,10 @@ class FormConfig implements FormConfigEditorInterface */ public function resetModelTransformers() { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->modelTransformers = array(); return $this; @@ -281,12 +328,16 @@ class FormConfig implements FormConfigEditorInterface * * @param DataTransformerInterface $modelTransformer * - * @return self The configuration object. + * @return FormConfigBuilder The configuration object. * * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ public function appendNormTransformer(DataTransformerInterface $modelTransformer) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + return $this->addModelTransformer($modelTransformer, true); } @@ -295,26 +346,34 @@ class FormConfig implements FormConfigEditorInterface * * @param DataTransformerInterface $modelTransformer * - * @return self The configuration object. + * @return FormConfigBuilder The configuration object. * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use * {@link addModelTransformer()} instead. */ public function prependNormTransformer(DataTransformerInterface $modelTransformer) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + return $this->addModelTransformer($modelTransformer); } /** * Alias of {@link resetModelTransformers()}. * - * @return self The configuration object. + * @return FormConfigBuilder The configuration object. * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use * {@link resetModelTransformers()} instead. */ public function resetNormTransformers() { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + return $this->resetModelTransformers(); } @@ -549,6 +608,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setAttribute($name, $value) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->attributes[$name] = $value; return $this; @@ -559,6 +622,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setAttributes(array $attributes) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->attributes = $attributes; return $this; @@ -569,6 +636,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setDataMapper(DataMapperInterface $dataMapper = null) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->dataMapper = $dataMapper; return $this; @@ -579,6 +650,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setDisabled($disabled) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->disabled = (Boolean) $disabled; return $this; @@ -589,6 +664,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setEmptyData($emptyData) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->emptyData = $emptyData; return $this; @@ -599,6 +678,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setErrorBubbling($errorBubbling) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->errorBubbling = null === $errorBubbling ? null : (Boolean) $errorBubbling; return $this; @@ -609,6 +692,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setRequired($required) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->required = (Boolean) $required; return $this; @@ -619,6 +706,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setPropertyPath($propertyPath) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + if (null !== $propertyPath && !$propertyPath instanceof PropertyPath) { $propertyPath = new PropertyPath($propertyPath); } @@ -633,6 +724,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setMapped($mapped) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->mapped = $mapped; return $this; @@ -643,6 +738,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setByReference($byReference) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->byReference = $byReference; return $this; @@ -653,6 +752,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setVirtual($virtual) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->virtual = $virtual; return $this; @@ -663,6 +766,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setCompound($compound) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->compound = $compound; return $this; @@ -673,6 +780,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setType(ResolvedFormTypeInterface $type) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->type = $type; return $this; @@ -683,6 +794,10 @@ class FormConfig implements FormConfigEditorInterface */ public function setData($data) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->data = $data; return $this; @@ -693,11 +808,31 @@ class FormConfig implements FormConfigEditorInterface */ public function setDataLocked($locked) { + if ($this->locked) { + throw new FormException('The config builder cannot be modified anymore.'); + } + $this->dataLocked = $locked; return $this; } + /** + * {@inheritdoc} + */ + public function getFormConfig() + { + // This method should be idempotent, so clone the builder + $config = clone $this; + $config->locked = true; + + if (!$config->dispatcher instanceof ImmutableEventDispatcher) { + $config->dispatcher = new ImmutableEventDispatcher($config->dispatcher); + } + + return $config; + } + /** * Validates whether the given variable is a valid form name. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigBuilderInterface.php similarity index 97% rename from vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php rename to vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigBuilderInterface.php index b84dbb0..988abb4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigBuilderInterface.php @@ -16,7 +16,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * @author Bernhard Schussek */ -interface FormConfigEditorInterface extends FormConfigInterface +interface FormConfigBuilderInterface extends FormConfigInterface { /** * Adds an event listener to an event on this form. @@ -240,4 +240,11 @@ interface FormConfigEditorInterface extends FormConfigInterface * @return self The configuration object. */ public function setDataLocked($locked); + + /** + * Builds and returns the form configuration. + * + * @return FormConfigInterface + */ + public function getFormConfig(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php index a925b1a..4ecbfb4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php @@ -23,9 +23,15 @@ class FormFactory implements FormFactoryInterface */ private $registry; - public function __construct(FormRegistryInterface $registry) + /** + * @var ResolvedFormTypeFactoryInterface + */ + private $resolvedTypeFactory; + + public function __construct(FormRegistryInterface $registry, ResolvedFormTypeFactoryInterface $resolvedTypeFactory) { $this->registry = $registry; + $this->resolvedTypeFactory = $resolvedTypeFactory; } /** @@ -73,14 +79,20 @@ class FormFactory implements FormFactoryInterface $options['data'] = $data; } - if ($type instanceof ResolvedFormTypeInterface) { - $this->registry->addType($type); - } elseif ($type instanceof FormTypeInterface) { - $type = $this->registry->resolveType($type); - $this->registry->addType($type); + if ($type instanceof FormTypeInterface) { + // An unresolved type instance was passed. Type extensions + // are not supported for these. If you want to use type + // extensions, you should create form extensions or register + // your type in the Dependency Injection configuration instead. + $parentType = $type->getParent(); + $type = $this->resolvedTypeFactory->createResolvedType( + $type, + array(), + $parentType ? $this->registry->getType($parentType) : null + ); } elseif (is_string($type)) { $type = $this->registry->getType($type); - } else { + } elseif (!$type instanceof ResolvedFormTypeInterface) { throw new UnexpectedTypeException($type, 'string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface'); } @@ -152,12 +164,18 @@ class FormFactory implements FormFactoryInterface * @param FormTypeInterface $type The type * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use - * {@link FormRegistryInterface::resolveType()} and - * {@link FormRegistryInterface::addType()} instead. + * form extensions or type registration in the Dependency + * Injection Container instead. */ public function addType(FormTypeInterface $type) { - $this->registry->addType($this->registry->resolveType($type)); + $parentType = $type->getParent(); + + $this->registry->addType($this->resolvedTypeFactory->createResolvedType( + $type, + array(), + $parentType ? $this->registry->getType($parentType) : null + )); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php index 12c6101..14f5cb3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php @@ -37,14 +37,20 @@ class FormRegistry implements FormRegistryInterface */ private $guesser; + /** + * @var ResolvedFormTypeFactoryInterface + */ + private $resolvedTypeFactory; + /** * Constructor. * - * @param array $extensions An array of FormExtensionInterface + * @param array $extensions An array of FormExtensionInterface + * @param ResolvedFormTypeFactoryInterface $resolvedTypeFactory The factory for resolved form types. * * @throws UnexpectedTypeException if any extension does not implement FormExtensionInterface */ - public function __construct(array $extensions) + public function __construct(array $extensions, ResolvedFormTypeFactoryInterface $resolvedTypeFactory) { foreach ($extensions as $extension) { if (!$extension instanceof FormExtensionInterface) { @@ -53,26 +59,7 @@ class FormRegistry implements FormRegistryInterface } $this->extensions = $extensions; - } - - /** - * {@inheritdoc} - */ - public function resolveType(FormTypeInterface $type) - { - $typeExtensions = array(); - - foreach ($this->extensions as $extension) { - /* @var FormExtensionInterface $extension */ - $typeExtensions = array_merge( - $typeExtensions, - $extension->getTypeExtensions($type->getName()) - ); - } - - $parent = $type->getParent() ? $this->getType($type->getParent()) : null; - - return new ResolvedFormType($type, $typeExtensions, $parent); + $this->resolvedTypeFactory = $resolvedTypeFactory; } /** @@ -93,6 +80,7 @@ class FormRegistry implements FormRegistryInterface } if (!isset($this->types[$name])) { + /** @var FormTypeInterface $type */ $type = null; foreach ($this->extensions as $extension) { @@ -107,7 +95,22 @@ class FormRegistry implements FormRegistryInterface throw new FormException(sprintf('Could not load type "%s"', $name)); } - $this->addType($this->resolveType($type)); + $parentType = $type->getParent(); + $typeExtensions = array(); + + foreach ($this->extensions as $extension) { + /* @var FormExtensionInterface $extension */ + $typeExtensions = array_merge( + $typeExtensions, + $extension->getTypeExtensions($name) + ); + } + + $this->addType($this->resolvedTypeFactory->createResolvedType( + $type, + $typeExtensions, + $parentType ? $this->getType($parentType) : null + )); } return $this->types[$name]; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistryInterface.php index 55773d4..1dcf7dc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistryInterface.php @@ -22,6 +22,10 @@ interface FormRegistryInterface * Adds a form type. * * @param ResolvedFormTypeInterface $type The type + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use + * form extensions or type registration in the Dependency + * Injection Container instead. */ public function addType(ResolvedFormTypeInterface $type); @@ -48,18 +52,6 @@ interface FormRegistryInterface */ public function hasType($name); - /** - * Resolves a form type. - * - * @param FormTypeInterface $type - * - * @return ResolvedFormTypeInterface - * - * @throws Exception\UnexpectedTypeException if the types parent {@link FormTypeInterface::getParent()} is not a string - * @throws Exception\FormException if the types parent can not be retrieved from any extension - */ - public function resolveType(FormTypeInterface $type); - /** * Returns the guesser responsible for guessing types. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormRenderer.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRenderer.php index 4d5538f..5c7c07e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormRenderer.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRenderer.php @@ -22,6 +22,8 @@ use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface; */ class FormRenderer implements FormRendererInterface { + const CACHE_KEY_VAR = 'unique_block_prefix'; + /** * @var FormRendererEngineInterface */ @@ -42,11 +44,6 @@ class FormRenderer implements FormRendererInterface */ private $hierarchyLevelMap = array(); - /** - * @var array - */ - private $variableMap = array(); - /** * @var array */ @@ -95,7 +92,8 @@ class FormRenderer implements FormRendererInterface throw new FormException('This method should only be called while rendering a form element.'); } - $scopeVariables = end($this->variableStack); + $viewCacheKey = $view->vars[self::CACHE_KEY_VAR]; + $scopeVariables = end($this->variableStack[$viewCacheKey]); $resource = $this->engine->getResourceForBlockName($view, $blockName); @@ -117,13 +115,13 @@ class FormRenderer implements FormRendererInterface // cannot be overwritten $variables = array_replace($scopeVariables, $variables); - $this->variableStack[] = $variables; + $this->variableStack[$viewCacheKey][] = $variables; // Do the rendering $html = $this->engine->renderBlock($view, $resource, $blockName, $variables); // Clear the stack - array_pop($this->variableStack); + array_pop($this->variableStack[$viewCacheKey]); return $html; } @@ -133,14 +131,15 @@ class FormRenderer implements FormRendererInterface */ public function searchAndRenderBlock(FormView $view, $blockNameSuffix, array $variables = array()) { - $renderOnlyOnce = in_array($blockNameSuffix, array('row', 'widget')); + $renderOnlyOnce = 'row' === $blockNameSuffix || 'widget' === $blockNameSuffix; if ($renderOnlyOnce && $view->isRendered()) { return ''; } // The cache key for storing the variables and types - $mapKey = $uniqueBlockName = $view->vars['full_block_name'] . '_' . $blockNameSuffix; + $viewCacheKey = $view->vars[self::CACHE_KEY_VAR]; + $viewAndSuffixCacheKey = $viewCacheKey . $blockNameSuffix; // In templates, we have to deal with two kinds of block hierarchies: // @@ -169,29 +168,40 @@ class FormRenderer implements FormRendererInterface // widget() function again to render the block for the parent type. // // The second kind is implemented in the following blocks. - if (!isset($this->blockNameHierarchyMap[$mapKey])) { + if (!isset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey])) { // INITIAL CALL // Calculate the hierarchy of template blocks and start on // the bottom level of the hierarchy (= "__
" block) $blockNameHierarchy = array(); - foreach ($view->vars['types'] as $type) { - $blockNameHierarchy[] = $type . '_' . $blockNameSuffix; + foreach ($view->vars['block_prefixes'] as $blockNamePrefix) { + $blockNameHierarchy[] = $blockNamePrefix . '_' . $blockNameSuffix; } - $blockNameHierarchy[] = $uniqueBlockName; $hierarchyLevel = count($blockNameHierarchy) - 1; - // The default variable scope contains all view variables, merged with - // the variables passed explicitly to the helper - $scopeVariables = $view->vars; + $hierarchyInit = true; } else { // RECURSIVE CALL // If a block recursively calls renderSection() again, resume rendering // using the parent type in the hierarchy. - $blockNameHierarchy = $this->blockNameHierarchyMap[$mapKey]; - $hierarchyLevel = $this->hierarchyLevelMap[$mapKey] - 1; + $blockNameHierarchy = $this->blockNameHierarchyMap[$viewAndSuffixCacheKey]; + $hierarchyLevel = $this->hierarchyLevelMap[$viewAndSuffixCacheKey] - 1; + $hierarchyInit = false; + } + + // The variables are cached globally for a view (instead of for the + // current suffix) + if (!isset($this->variableStack[$viewCacheKey])) { + // The default variable scope contains all view variables, merged with + // the variables passed explicitly to the helper + $scopeVariables = $view->vars; + + $varInit = true; + } else { // Reuse the current scope and merge it with the explicitly passed variables - $scopeVariables = $this->variableMap[$mapKey]; + $scopeVariables = end($this->variableStack[$viewCacheKey]); + + $varInit = false; } // Load the resource where this block can be found @@ -235,28 +245,29 @@ class FormRenderer implements FormRendererInterface // We need to store these values in maps (associative arrays) because within a // call to widget() another call to widget() can be made, but for a different view // object. These nested calls should not override each other. - $this->blockNameHierarchyMap[$mapKey] = $blockNameHierarchy; - $this->hierarchyLevelMap[$mapKey] = $hierarchyLevel; - $this->variableMap[$mapKey] = $variables; + $this->blockNameHierarchyMap[$viewAndSuffixCacheKey] = $blockNameHierarchy; + $this->hierarchyLevelMap[$viewAndSuffixCacheKey] = $hierarchyLevel; - // We also need to store the view and the variables so that we can render custom - // blocks with renderBlock() using the same themes and variables as in the outer - // block. - // - // A stack is sufficient for this purpose, because renderBlock() always accesses - // the immediate next outer scope, which is always stored at the end of the stack. - $this->variableStack[] = $variables; + // We also need to store the variables for the view so that we can render other + // blocks for the same view using the same variables as in the outer block. + $this->variableStack[$viewCacheKey][] = $variables; // Do the rendering $html = $this->engine->renderBlock($view, $resource, $blockName, $variables); // Clear the stack - array_pop($this->variableStack); + array_pop($this->variableStack[$viewCacheKey]); - // Clear the maps - unset($this->blockNameHierarchyMap[$mapKey]); - unset($this->hierarchyLevelMap[$mapKey]); - unset($this->variableMap[$mapKey]); + // Clear the caches if they were filled for the first time within + // this function call + if ($hierarchyInit) { + unset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey]); + unset($this->hierarchyLevelMap[$viewAndSuffixCacheKey]); + } + + if ($varInit) { + unset($this->variableStack[$viewCacheKey]); + } if ($renderOnlyOnce) { $view->setRendered(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/ImmutableFormConfig.php b/vendor/symfony/symfony/src/Symfony/Component/Form/ImmutableFormConfig.php deleted file mode 100644 index 36bd867..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/ImmutableFormConfig.php +++ /dev/null @@ -1,365 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form; - -use Symfony\Component\Form\Util\PropertyPath; -use Symfony\Component\EventDispatcher\ImmutableEventDispatcher; - -/** - * A read-only form configuration. - * - * @author Bernhard Schussek - */ -class ImmutableFormConfig implements FormConfigInterface -{ - /** - * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface - */ - private $dispatcher; - - /** - * @var string - */ - private $name; - - /** - * @var PropertyPath - */ - private $propertyPath; - - /** - * @var Boolean - */ - private $mapped; - - /** - * @var Boolean - */ - private $byReference; - - /** - * @var Boolean - */ - private $virtual; - - /** - * @var Boolean - */ - private $compound; - - /** - * @var ResolvedFormTypeInterface - */ - private $type; - - /** - * @var array - */ - private $viewTransformers; - - /** - * @var array - */ - private $modelTransformers; - - /** - * @var DataMapperInterface - */ - private $dataMapper; - - /** - * @var FormValidatorInterface - */ - private $validators; - - /** - * @var Boolean - */ - private $required; - - /** - * @var Boolean - */ - private $disabled; - - /** - * @var Boolean - */ - private $errorBubbling; - - /** - * @var mixed - */ - private $emptyData; - - /** - * @var array - */ - private $attributes; - - /** - * @var mixed - */ - private $data; - - /** - * @var string - */ - private $dataClass; - - /** - * @var Boolean - */ - private $dataLocked; - - /** - * @var array - */ - private $options; - - /** - * Creates an unmodifiable copy of a given configuration. - * - * @param FormConfigInterface $config The configuration to copy. - */ - public function __construct(FormConfigInterface $config) - { - $dispatcher = $config->getEventDispatcher(); - if (!$dispatcher instanceof ImmutableEventDispatcher) { - $dispatcher = new ImmutableEventDispatcher($dispatcher); - } - - $this->dispatcher = $dispatcher; - $this->name = $config->getName(); - $this->propertyPath = $config->getPropertyPath(); - $this->mapped = $config->getMapped(); - $this->byReference = $config->getByReference(); - $this->virtual = $config->getVirtual(); - $this->compound = $config->getCompound(); - $this->type = $config->getType(); - $this->viewTransformers = $config->getViewTransformers(); - $this->modelTransformers = $config->getModelTransformers(); - $this->dataMapper = $config->getDataMapper(); - $this->validators = $config->getValidators(); - $this->required = $config->getRequired(); - $this->disabled = $config->getDisabled(); - $this->errorBubbling = $config->getErrorBubbling(); - $this->emptyData = $config->getEmptyData(); - $this->attributes = $config->getAttributes(); - $this->data = $config->getData(); - $this->dataClass = $config->getDataClass(); - $this->dataLocked = $config->getDataLocked(); - $this->options = $config->getOptions(); - } - - /** - * {@inheritdoc} - */ - public function getEventDispatcher() - { - return $this->dispatcher; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - /** - * {@inheritdoc} - */ - public function getPropertyPath() - { - return $this->propertyPath; - } - - /** - * {@inheritdoc} - */ - public function getMapped() - { - return $this->mapped; - } - - /** - * {@inheritdoc} - */ - public function getByReference() - { - return $this->byReference; - } - - /** - * {@inheritdoc} - */ - public function getVirtual() - { - return $this->virtual; - } - - /** - * {@inheritdoc} - */ - public function getCompound() - { - return $this->compound; - } - - /** - * {@inheritdoc} - */ - public function getType() - { - return $this->type; - } - - /** - * {@inheritdoc} - */ - public function getViewTransformers() - { - return $this->viewTransformers; - } - - /** - * {@inheritdoc} - */ - public function getModelTransformers() - { - return $this->modelTransformers; - } - - /** - * Returns the data mapper of the form. - * - * @return DataMapperInterface The data mapper. - */ - public function getDataMapper() - { - return $this->dataMapper; - } - - /** - * {@inheritdoc} - */ - public function getValidators() - { - return $this->validators; - } - - /** - * {@inheritdoc} - */ - public function getRequired() - { - return $this->required; - } - - /** - * {@inheritdoc} - */ - public function getDisabled() - { - return $this->disabled; - } - - /** - * {@inheritdoc} - */ - public function getErrorBubbling() - { - return $this->errorBubbling; - } - - /** - * {@inheritdoc} - */ - public function getEmptyData() - { - return $this->emptyData; - } - - /** - * {@inheritdoc} - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * {@inheritdoc} - */ - public function hasAttribute($name) - { - return isset($this->attributes[$name]); - } - - /** - * {@inheritdoc} - */ - public function getAttribute($name, $default = null) - { - return isset($this->attributes[$name]) ? $this->attributes[$name] : $default; - } - - /** - * {@inheritdoc} - */ - public function getData() - { - return $this->data; - } - - /** - * {@inheritdoc} - */ - public function getDataClass() - { - return $this->dataClass; - } - - /** - * {@inheritdoc} - */ - public function getDataLocked() - { - return $this->dataLocked; - } - - /** - * {@inheritdoc} - */ - public function getOptions() - { - return $this->options; - } - - /** - * {@inheritdoc} - */ - public function hasOption($name) - { - return isset($this->options[$name]); - } - - /** - * {@inheritdoc} - */ - public function getOption($name, $default = null) - { - return isset($this->options[$name]) ? $this->options[$name] : $default; - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php index 8bbd7ae..64427a8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php @@ -35,7 +35,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface private $typeExtensions; /** - * @var ResolvedFormType + * @var ResolvedFormTypeInterface */ private $parent; @@ -44,7 +44,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface */ private $optionsResolver; - public function __construct(FormTypeInterface $innerType, array $typeExtensions = array(), ResolvedFormType $parent = null) + public function __construct(FormTypeInterface $innerType, array $typeExtensions = array(), ResolvedFormTypeInterface $parent = null) { if (!preg_match('/^[a-z0-9_]*$/i', $innerType->getName())) { throw new FormException(sprintf( @@ -148,7 +148,16 @@ class ResolvedFormType implements ResolvedFormTypeInterface return $view; } - private function buildForm(FormBuilderInterface $builder, array $options) + /** + * Configures a form builder for the type hierarchy. + * + * This method is protected in order to allow implementing classes + * to change or call it in re-implementations of {@link createBuilder()}. + * + * @param FormBuilderInterface $builder The builder to configure. + * @param array $options The options used for the configuration. + */ + public function buildForm(FormBuilderInterface $builder, array $options) { if (null !== $this->parent) { $this->parent->buildForm($builder, $options); @@ -162,7 +171,19 @@ class ResolvedFormType implements ResolvedFormTypeInterface } } - private function buildView(FormView $view, FormInterface $form, array $options) + /** + * Configures a form view for the type hierarchy. + * + * This method is protected in order to allow implementing classes + * to change or call it in re-implementations of {@link createView()}. + * + * It is called before the children of the view are built. + * + * @param FormView $view The form view to configure. + * @param FormInterface $form The form corresponding to the view. + * @param array $options The options used for the configuration. + */ + public function buildView(FormView $view, FormInterface $form, array $options) { if (null !== $this->parent) { $this->parent->buildView($view, $form, $options); @@ -176,7 +197,19 @@ class ResolvedFormType implements ResolvedFormTypeInterface } } - private function finishView(FormView $view, FormInterface $form, array $options) + /** + * Finishes a form view for the type hierarchy. + * + * This method is protected in order to allow implementing classes + * to change or call it in re-implementations of {@link createView()}. + * + * It is called after the children of the view have been built. + * + * @param FormView $view The form view to configure. + * @param FormInterface $form The form corresponding to the view. + * @param array $options The options used for the configuration. + */ + public function finishView(FormView $view, FormInterface $form, array $options) { if (null !== $this->parent) { $this->parent->finishView($view, $form, $options); @@ -190,7 +223,15 @@ class ResolvedFormType implements ResolvedFormTypeInterface } } - private function getOptionsResolver() + /** + * Returns the configured options resolver used for this type. + * + * This method is protected in order to allow implementing classes + * to change or call it in re-implementations of {@link createBuilder()}. + * + * @return \Symfony\Component\OptionsResolver\OptionsResolverInterface The options resolver. + */ + public function getOptionsResolver() { if (null === $this->optionsResolver) { if (null !== $this->parent) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeFactory.php b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeFactory.php new file mode 100644 index 0000000..d93d1c0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeFactory.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * @author Bernhard Schussek + */ +class ResolvedFormTypeFactory implements ResolvedFormTypeFactoryInterface +{ + /** + * {@inheritdoc} + */ + public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null) + { + return new ResolvedFormType($type, $typeExtensions, $parent); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php new file mode 100644 index 0000000..fb2aa4a --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * Creates ResolvedFormTypeInterface instances. + * + * This interface allows you to use your custom ResolvedFormTypeInterface + * implementation, within which you can customize the concrete FormBuilderInterface + * implementations or FormView subclasses that are used by the framework. + * + * @author Bernhard Schussek + */ +interface ResolvedFormTypeFactoryInterface +{ + /** + * Resolves a form type. + * + * @param FormTypeInterface $type + * @param array $typeExtensions + * @param ResolvedFormTypeInterface $parent + * + * @return ResolvedFormTypeInterface + * + * @throws Exception\UnexpectedTypeException if the types parent {@link FormTypeInterface::getParent()} is not a string + * @throws Exception\FormException if the types parent can not be retrieved from any extension + */ + public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null); +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeInterface.php index cb9787c..c6333d5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeInterface.php @@ -67,4 +67,41 @@ interface ResolvedFormTypeInterface * @return FormView The created form view. */ public function createView(FormInterface $form, FormView $parent = null); + + /** + * Configures a form builder for the type hierarchy. + * + * @param FormBuilderInterface $builder The builder to configure. + * @param array $options The options used for the configuration. + */ + public function buildForm(FormBuilderInterface $builder, array $options); + + /** + * Configures a form view for the type hierarchy. + * + * It is called before the children of the view are built. + * + * @param FormView $view The form view to configure. + * @param FormInterface $form The form corresponding to the view. + * @param array $options The options used for the configuration. + */ + public function buildView(FormView $view, FormInterface $form, array $options); + + /** + * Finishes a form view for the type hierarchy. + * + * It is called after the children of the view have been built. + * + * @param FormView $view The form view to configure. + * @param FormInterface $form The form corresponding to the view. + * @param array $options The options used for the configuration. + */ + public function finishView(FormView $view, FormInterface $form, array $options); + + /** + * Returns the configured options resolver used for this type. + * + * @return \Symfony\Component\OptionsResolver\OptionsResolverInterface The options resolver. + */ + public function getOptionsResolver(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php index bb97cd6..576d789 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Tests; use Symfony\Component\Form\FormError; +use Symfony\Component\Form\Tests\Fixtures\AlternatingRowType; abstract class AbstractDivLayoutTest extends AbstractLayoutTest { @@ -38,13 +39,17 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest public function testRowOverrideVariables() { $view = $this->factory->createNamed('name', 'text')->createView(); - $html = $this->renderRow($view, array('label' => 'foo&bar')); + $html = $this->renderRow($view, array( + 'attr' => array('class' => 'my&class'), + 'label' => 'foo&bar', + 'label_attr' => array('class' => 'my&label&class'), + )); $this->assertMatchesXpath($html, '/div [ - ./label[@for="name"][.="[trans]foo&bar[/trans]"] - /following-sibling::input[@id="name"] + ./label[@for="name"][@class="my&label&class required"][.="[trans]foo&bar[/trans]"] + /following-sibling::input[@id="name"][@class="my&class"] ] ' ); @@ -279,6 +284,29 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest ); } + // https://github.com/symfony/symfony/issues/5038 + public function testCollectionWithAlternatingRowTypes() + { + $data = array( + array('title' => 'a'), + array('title' => 'b'), + ); + $form = $this->factory->createNamed('name', 'collection', $data, array( + 'type' => new AlternatingRowType(), + )); + + $this->assertWidgetMatchesXpath($form->createView(), array(), +'/div + [ + ./div[./div/div/input[@type="text"][@value="a"]] + /following-sibling::div[./div/div/textarea[.="b"]] + ] + [count(./div[./div/div/input])=1] + [count(./div[./div/div/textarea])=1] +' + ); + } + public function testEmptyCollection() { $form = $this->factory->createNamed('name', 'collection', array(), array( @@ -437,7 +465,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest public function testRepeatedWithCustomOptions() { $form = $this->factory->createNamed('name', 'repeated', null, array( - // the global required value cannot be overriden + // the global required value cannot be overridden 'first_options' => array('label' => 'Test', 'required' => false), 'second_options' => array('label' => 'Test2') )); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index 40195c2..e938a5f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -66,7 +66,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase // the top level $dom->loadXml(''.$html.''); } catch (\Exception $e) { - return $this->fail(sprintf( + $this->fail(sprintf( "Failed loading HTML:\n\n%s\n\nError: %s", $html, $e->getMessage() @@ -225,7 +225,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase ); } - public function testLabelWithCustomOptionsPassedDirectly() + public function testLabelWithCustomAttributesPassedDirectly() { $form = $this->factory->createNamed('name', 'text'); $html = $this->renderLabel($form->createView(), null, array( @@ -242,7 +242,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase ); } - public function testLabelWithCustomTextAndCustomOptionsPassedDirectly() + public function testLabelWithCustomTextAndCustomAttributesPassedDirectly() { $form = $this->factory->createNamed('name', 'text'); $html = $this->renderLabel($form->createView(), 'Custom label', array( @@ -260,6 +260,27 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase ); } + // https://github.com/symfony/symfony/issues/5029 + public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly() + { + $form = $this->factory->createNamed('name', 'text', null, array( + 'label' => 'Custom label', + )); + $html = $this->renderLabel($form->createView(), null, array( + 'label_attr' => array( + 'class' => 'my&class' + ), + )); + + $this->assertMatchesXpath($html, + '/label + [@for="name"] + [@class="my&class required"] + [.="[trans]Custom label[/trans]"] +' + ); + } + public function testErrors() { $form = $this->factory->createNamed('name', 'text'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php index 1436d83..c21c712 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php @@ -116,7 +116,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest ->getForm() ->createView(); - // Render field2 row -> does not implicitely call renderWidget because + // Render field2 row -> does not implicitly call renderWidget because // it is a repeated field! $this->renderRow($view['field2']); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php index 4e59185..122a44a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Form\Tests; use Symfony\Component\Form\Form; use Symfony\Component\Form\FormView; use Symfony\Component\Form\FormError; -use Symfony\Component\Form\Extension\Core\EventListener\BindRequestListener; +use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\EventDispatcher\EventDispatcher; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ChoiceListTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ChoiceListTest.php index 8dc3828..86533e8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ChoiceListTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ChoiceListTest.php @@ -69,8 +69,40 @@ class ChoiceListTest extends \PHPUnit_Framework_TestCase $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices()); $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues()); - $this->assertEquals(array(1 => new ChoiceView('1', 'B')), $this->list->getPreferredViews()); - $this->assertEquals(array(0 => new ChoiceView('0', 'A'), 2 => new ChoiceView('2', 'C'), 3 => new ChoiceView('3', 'D')), $this->list->getRemainingViews()); + $this->assertEquals(array(1 => new ChoiceView($this->obj2, '1', 'B')), $this->list->getPreferredViews()); + $this->assertEquals(array(0 => new ChoiceView($this->obj1, '0', 'A'), 2 => new ChoiceView($this->obj3, '2', 'C'), 3 => new ChoiceView($this->obj4, '3', 'D')), $this->list->getRemainingViews()); + } + + /** + * Necessary for interoperability with MongoDB cursors or ORM relations as + * choices parameter. A choice itself that is an object implementing \Traversable + * is not treated as hierarchical structure, but as-is. + */ + public function testInitNestedTraversable() + { + $traversableChoice = new \ArrayIterator(array($this->obj3, $this->obj4)); + + $this->list = new ChoiceList( + new \ArrayIterator(array( + 'Group' => array($this->obj1, $this->obj2), + 'Not a Group' => $traversableChoice + )), + array( + 'Group' => array('A', 'B'), + 'Not a Group' => 'C', + ), + array($this->obj2) + ); + + $this->assertSame(array($this->obj1, $this->obj2, $traversableChoice), $this->list->getChoices()); + $this->assertSame(array('0', '1', '2'), $this->list->getValues()); + $this->assertEquals(array( + 'Group' => array(1 => new ChoiceView($this->obj2, '1', 'B')) + ), $this->list->getPreferredViews()); + $this->assertEquals(array( + 'Group' => array(0 => new ChoiceView($this->obj1, '0', 'A')), + 2 => new ChoiceView($traversableChoice, '2', 'C') + ), $this->list->getRemainingViews()); } public function testInitNestedArray() @@ -78,12 +110,12 @@ class ChoiceListTest extends \PHPUnit_Framework_TestCase $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices()); $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues()); $this->assertEquals(array( - 'Group 1' => array(1 => new ChoiceView('1', 'B')), - 'Group 2' => array(2 => new ChoiceView('2', 'C')) + 'Group 1' => array(1 => new ChoiceView($this->obj2, '1', 'B')), + 'Group 2' => array(2 => new ChoiceView($this->obj3, '2', 'C')) ), $this->list->getPreferredViews()); $this->assertEquals(array( - 'Group 1' => array(0 => new ChoiceView('0', 'A')), - 'Group 2' => array(3 => new ChoiceView('3', 'D')) + 'Group 1' => array(0 => new ChoiceView($this->obj1, '0', 'A')), + 'Group 2' => array(3 => new ChoiceView($this->obj4, '3', 'D')) ), $this->list->getRemainingViews()); } @@ -141,4 +173,15 @@ class ChoiceListTest extends \PHPUnit_Framework_TestCase $choices = array($this->obj2, $this->obj3, 'foobar'); $this->assertSame(array('1', '2'), $this->list->getValuesForChoices($choices)); } + + /** + * @expectedException \InvalidArgumentException + */ + public function testNonMatchingLabels() + { + $this->list = new ChoiceList( + array($this->obj1, $this->obj2), + array('A') + ); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/LazyChoiceListTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/LazyChoiceListTest.php index 752be7d..628ac60 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/LazyChoiceListTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/LazyChoiceListTest.php @@ -49,12 +49,12 @@ class LazyChoiceListTest extends \PHPUnit_Framework_TestCase public function testGetPreferredViews() { - $this->assertEquals(array(1 => new ChoiceView('b', 'B')), $this->list->getPreferredViews()); + $this->assertEquals(array(1 => new ChoiceView('b', 'b', 'B')), $this->list->getPreferredViews()); } public function testGetRemainingViews() { - $this->assertEquals(array(0 => new ChoiceView('a', 'A'), 2 => new ChoiceView('c', 'C')), $this->list->getRemainingViews()); + $this->assertEquals(array(0 => new ChoiceView('a', 'a', 'A'), 2 => new ChoiceView('c', 'c', 'C')), $this->list->getRemainingViews()); } public function testGetIndicesForChoices() diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ObjectChoiceListTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ObjectChoiceListTest.php index 44c1c8f..12f22d2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ObjectChoiceListTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ObjectChoiceListTest.php @@ -81,8 +81,8 @@ class ObjectChoiceListTest extends \PHPUnit_Framework_TestCase $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices()); $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues()); - $this->assertEquals(array(1 => new ChoiceView('1', 'B')), $this->list->getPreferredViews()); - $this->assertEquals(array(0 => new ChoiceView('0', 'A'), 2 => new ChoiceView('2', 'C'), 3 => new ChoiceView('3', 'D')), $this->list->getRemainingViews()); + $this->assertEquals(array(1 => new ChoiceView($this->obj2, '1', 'B')), $this->list->getPreferredViews()); + $this->assertEquals(array(0 => new ChoiceView($this->obj1, '0', 'A'), 2 => new ChoiceView($this->obj3, '2', 'C'), 3 => new ChoiceView($this->obj4, '3', 'D')), $this->list->getRemainingViews()); } public function testInitNestedArray() @@ -90,12 +90,12 @@ class ObjectChoiceListTest extends \PHPUnit_Framework_TestCase $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices()); $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues()); $this->assertEquals(array( - 'Group 1' => array(1 => new ChoiceView('1', 'B')), - 'Group 2' => array(2 => new ChoiceView('2', 'C')) + 'Group 1' => array(1 => new ChoiceView($this->obj2, '1', 'B')), + 'Group 2' => array(2 => new ChoiceView($this->obj3, '2', 'C')) ), $this->list->getPreferredViews()); $this->assertEquals(array( - 'Group 1' => array(0 => new ChoiceView('0', 'A')), - 'Group 2' => array(3 => new ChoiceView('3', 'D')) + 'Group 1' => array(0 => new ChoiceView($this->obj1, '0', 'A')), + 'Group 2' => array(3 => new ChoiceView($this->obj4, '3', 'D')) ), $this->list->getRemainingViews()); } @@ -123,14 +123,14 @@ class ObjectChoiceListTest extends \PHPUnit_Framework_TestCase $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4, $obj5, $obj6), $this->list->getChoices()); $this->assertSame(array('0', '1', '2', '3', '4', '5'), $this->list->getValues()); $this->assertEquals(array( - 'Group 1' => array(1 => new ChoiceView('1', 'B')), - 'Group 2' => array(2 => new ChoiceView('2', 'C')) + 'Group 1' => array(1 => new ChoiceView($this->obj2, '1', 'B')), + 'Group 2' => array(2 => new ChoiceView($this->obj3, '2', 'C')) ), $this->list->getPreferredViews()); $this->assertEquals(array( - 'Group 1' => array(0 => new ChoiceView('0', 'A')), - 'Group 2' => array(3 => new ChoiceView('3', 'D')), - 4 => new ChoiceView('4', 'E'), - 5 => new ChoiceView('5', 'F'), + 'Group 1' => array(0 => new ChoiceView($this->obj1, '0', 'A')), + 'Group 2' => array(3 => new ChoiceView($this->obj4, '3', 'D')), + 4 => new ChoiceView($obj5, '4', 'E'), + 5 => new ChoiceView($obj6, '5', 'F'), ), $this->list->getRemainingViews()); } @@ -172,8 +172,8 @@ class ObjectChoiceListTest extends \PHPUnit_Framework_TestCase $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices()); $this->assertSame(array('10', '20', '30', '40'), $this->list->getValues()); - $this->assertEquals(array(1 => new ChoiceView('20', 'B'), 2 => new ChoiceView('30', 'C')), $this->list->getPreferredViews()); - $this->assertEquals(array(0 => new ChoiceView('10', 'A'), 3 => new ChoiceView('40', 'D')), $this->list->getRemainingViews()); + $this->assertEquals(array(1 => new ChoiceView($this->obj2, '20', 'B'), 2 => new ChoiceView($this->obj3, '30', 'C')), $this->list->getPreferredViews()); + $this->assertEquals(array(0 => new ChoiceView($this->obj1, '10', 'A'), 3 => new ChoiceView($this->obj4, '40', 'D')), $this->list->getRemainingViews()); } public function testInitArrayUsesToString() @@ -189,7 +189,7 @@ class ObjectChoiceListTest extends \PHPUnit_Framework_TestCase $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices()); $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues()); - $this->assertEquals(array(0 => new ChoiceView('0', 'A'), 1 => new ChoiceView('1', 'B'), 2 => new ChoiceView('2', 'C'), 3 => new ChoiceView('3', 'D')), $this->list->getRemainingViews()); + $this->assertEquals(array(0 => new ChoiceView($this->obj1, '0', 'A'), 1 => new ChoiceView($this->obj2, '1', 'B'), 2 => new ChoiceView($this->obj3, '2', 'C'), 3 => new ChoiceView($this->obj4, '3', 'D')), $this->list->getRemainingViews()); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/SimpleChoiceListTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/SimpleChoiceListTest.php index 485923c..69d27a1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/SimpleChoiceListTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/SimpleChoiceListTest.php @@ -55,8 +55,8 @@ class SimpleChoiceListTest extends \PHPUnit_Framework_TestCase $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getChoices()); $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getValues()); - $this->assertEquals(array(1 => new ChoiceView('b', 'B')), $this->list->getPreferredViews()); - $this->assertEquals(array(0 => new ChoiceView('a', 'A'), 2 => new ChoiceView('c', 'C')), $this->list->getRemainingViews()); + $this->assertEquals(array(1 => new ChoiceView('b', 'b', 'B')), $this->list->getPreferredViews()); + $this->assertEquals(array(0 => new ChoiceView('a', 'a', 'A'), 2 => new ChoiceView('c', 'c', 'C')), $this->list->getRemainingViews()); } public function testInitNestedArray() @@ -64,12 +64,12 @@ class SimpleChoiceListTest extends \PHPUnit_Framework_TestCase $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd'), $this->list->getChoices()); $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd'), $this->list->getValues()); $this->assertEquals(array( - 'Group 1' => array(1 => new ChoiceView('b', 'B')), - 'Group 2' => array(2 => new ChoiceView('c', 'C')) + 'Group 1' => array(1 => new ChoiceView('b', 'b', 'B')), + 'Group 2' => array(2 => new ChoiceView('c', 'c', 'C')) ), $this->list->getPreferredViews()); $this->assertEquals(array( - 'Group 1' => array(0 => new ChoiceView('a', 'A')), - 'Group 2' => array(3 => new ChoiceView('d', 'D')) + 'Group 1' => array(0 => new ChoiceView('a', 'a', 'A')), + 'Group 2' => array(3 => new ChoiceView('d', 'd', 'D')) ), $this->list->getRemainingViews()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php index 0a4c8b8..05d2fe1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\DataMapper; use Symfony\Component\Form\Form; -use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormConfigBuilder; use Symfony\Component\Form\FormConfigInterface; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper; @@ -89,7 +89,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase ->with($car) ->will($this->returnValue($engine)); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($propertyPath); $form = $this->getForm($config); @@ -112,7 +112,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase ->with($car) ->will($this->returnValue($engine)); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(false); $config->setPropertyPath($propertyPath); $form = $this->getForm($config); @@ -127,7 +127,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase { $car = new \stdClass(); - $config = new FormConfig(null, '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder(null, '\stdClass', $this->dispatcher); $config->setByReference(true); $form = $this->getForm($config); @@ -146,7 +146,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase $propertyPath->expects($this->never()) ->method('getValue'); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setMapped(false); $config->setPropertyPath($propertyPath); @@ -164,7 +164,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase $propertyPath->expects($this->never()) ->method('getValue'); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($propertyPath); $form = $this->getForm($config); @@ -185,14 +185,14 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase ->with($car) ->will($this->returnValue($engine)); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setVirtual(true); $config->setCompound(true); $config->setDataMapper($this->getDataMapper()); $form = $this->getForm($config); - $config = new FormConfig('engine', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('engine', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($propertyPath); $child = $this->getForm($config); @@ -215,7 +215,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase ->method('setValue') ->with($car, $engine); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(false); $config->setPropertyPath($propertyPath); $config->setData($engine); @@ -234,7 +234,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase ->method('setValue') ->with($car, $engine); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($propertyPath); $config->setData($engine); @@ -258,7 +258,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase $propertyPath->expects($this->never()) ->method('setValue'); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($propertyPath); $config->setData($engine); @@ -276,7 +276,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase $propertyPath->expects($this->never()) ->method('setValue'); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($propertyPath); $config->setData($engine); @@ -294,7 +294,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase $propertyPath->expects($this->never()) ->method('setValue'); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($propertyPath); $config->setData(null); @@ -312,7 +312,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase $propertyPath->expects($this->never()) ->method('setValue'); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($propertyPath); $config->setData($engine); @@ -330,7 +330,7 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase $propertyPath->expects($this->never()) ->method('setValue'); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($propertyPath); $config->setData($engine); @@ -356,14 +356,14 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase ->method('setValue') ->with($car, $engine); - $config = new FormConfig('name', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher); $config->setPropertyPath($parentPath); $config->setVirtual(true); $config->setCompound(true); $config->setDataMapper($this->getDataMapper()); $form = $this->getForm($config); - $config = new FormConfig('engine', '\stdClass', $this->dispatcher); + $config = new FormConfigBuilder('engine', '\stdClass', $this->dispatcher); $config->setByReference(true); $config->setPropertyPath($childPath); $config->setData($engine); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php index 7b3490c..5971777 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php @@ -654,10 +654,10 @@ class ChoiceTypeTest extends TypeTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('a', 'A'), - new ChoiceView('b', 'B'), - new ChoiceView('c', 'C'), - new ChoiceView('d', 'D'), + new ChoiceView('a', 'a', 'A'), + new ChoiceView('b', 'b', 'B'), + new ChoiceView('c', 'c', 'C'), + new ChoiceView('d', 'd', 'D'), ), $view->vars['choices']); } @@ -671,12 +671,12 @@ class ChoiceTypeTest extends TypeTestCase $view = $form->createView(); $this->assertEquals(array( - 0 => new ChoiceView('a', 'A'), - 2 => new ChoiceView('c', 'C'), + 0 => new ChoiceView('a', 'a', 'A'), + 2 => new ChoiceView('c', 'c', 'C'), ), $view->vars['choices']); $this->assertEquals(array( - 1 => new ChoiceView('b', 'B'), - 3 => new ChoiceView('d', 'D'), + 1 => new ChoiceView('b', 'b', 'B'), + 3 => new ChoiceView('d', 'd', 'D'), ), $view->vars['preferred_choices']); } @@ -690,23 +690,42 @@ class ChoiceTypeTest extends TypeTestCase $this->assertEquals(array( 'Symfony' => array( - 0 => new ChoiceView('a', 'Bernhard'), - 2 => new ChoiceView('c', 'Kris'), + 0 => new ChoiceView('a', 'a', 'Bernhard'), + 2 => new ChoiceView('c', 'c', 'Kris'), ), 'Doctrine' => array( - 4 => new ChoiceView('e', 'Roman'), + 4 => new ChoiceView('e', 'e', 'Roman'), ), ), $view->vars['choices']); $this->assertEquals(array( 'Symfony' => array( - 1 => new ChoiceView('b', 'Fabien'), + 1 => new ChoiceView('b', 'b', 'Fabien'), ), 'Doctrine' => array( - 3 => new ChoiceView('d', 'Jon'), + 3 => new ChoiceView('d', 'd', 'Jon'), ), ), $view->vars['preferred_choices']); } + public function testPassChoiceDataToView() + { + $obj1 = (object) array('value' => 'a', 'label' => 'A'); + $obj2 = (object) array('value' => 'b', 'label' => 'B'); + $obj3 = (object) array('value' => 'c', 'label' => 'C'); + $obj4 = (object) array('value' => 'd', 'label' => 'D'); + $form = $this->factory->create('choice', null, array( + 'choice_list' => new ObjectChoiceList(array($obj1, $obj2, $obj3, $obj4), 'label', array(), null, 'value'), + )); + $view = $form->createView(); + + $this->assertEquals(array( + new ChoiceView($obj1, 'a', 'A'), + new ChoiceView($obj2, 'b', 'B'), + new ChoiceView($obj3, 'c', 'C'), + new ChoiceView($obj4, 'd', 'D'), + ), $view->vars['choices']); + } + public function testAdjustFullNameForMultipleNonExpanded() { $form = $this->factory->createNamed('name', 'choice', null, array( diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php index b607c3f..e5c24a3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php @@ -24,11 +24,11 @@ class CountryTypeTest extends LocalizedTestCase $choices = $view->vars['choices']; // Don't check objects for identity - $this->assertContains(new ChoiceView('DE', 'Deutschland'), $choices, '', false, false); - $this->assertContains(new ChoiceView('GB', 'Vereinigtes Königreich'), $choices, '', false, false); - $this->assertContains(new ChoiceView('US', 'Vereinigte Staaten'), $choices, '', false, false); - $this->assertContains(new ChoiceView('FR', 'Frankreich'), $choices, '', false, false); - $this->assertContains(new ChoiceView('MY', 'Malaysia'), $choices, '', false, false); + $this->assertContains(new ChoiceView('DE', 'DE', 'Deutschland'), $choices, '', false, false); + $this->assertContains(new ChoiceView('GB', 'GB', 'Vereinigtes Königreich'), $choices, '', false, false); + $this->assertContains(new ChoiceView('US', 'US', 'Vereinigte Staaten'), $choices, '', false, false); + $this->assertContains(new ChoiceView('FR', 'FR', 'Frankreich'), $choices, '', false, false); + $this->assertContains(new ChoiceView('MY', 'MY', 'Malaysia'), $choices, '', false, false); } public function testUnknownCountryIsNotIncluded() diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index 158d416..13b9d06 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -355,8 +355,8 @@ class DateTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('2010', '2010'), - new ChoiceView('2011', '2011'), + new ChoiceView('2010', '2010', '2010'), + new ChoiceView('2011', '2011', '2011'), ), $view['year']->vars['choices']); } @@ -369,8 +369,8 @@ class DateTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('6', '06'), - new ChoiceView('7', '07'), + new ChoiceView('6', '6', '06'), + new ChoiceView('7', '7', '07'), ), $view['month']->vars['choices']); } @@ -384,8 +384,8 @@ class DateTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('1', 'Jän'), - new ChoiceView('4', 'Apr') + new ChoiceView('1', '1', 'Jän'), + new ChoiceView('4', '4', 'Apr') ), $view['month']->vars['choices']); } @@ -399,8 +399,8 @@ class DateTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('1', 'Jänner'), - new ChoiceView('4', 'April'), + new ChoiceView('1', '1', 'Jänner'), + new ChoiceView('4', '4', 'April'), ), $view['month']->vars['choices']); } @@ -414,8 +414,8 @@ class DateTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('1', 'Jänner'), - new ChoiceView('4', 'April'), + new ChoiceView('1', '1', 'Jänner'), + new ChoiceView('4', '4', 'April'), ), $view['month']->vars['choices']); } @@ -428,8 +428,8 @@ class DateTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('6', '06'), - new ChoiceView('7', '07'), + new ChoiceView('6', '6', '06'), + new ChoiceView('7', '7', '07'), ), $view['day']->vars['choices']); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php index 8fe84a6..6fbddeb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php @@ -206,7 +206,7 @@ class FormTypeTest extends TypeTestCase $this->assertEquals('test', $view['child']->vars['translation_domain']); } - public function testNonTranlsationDomainFormWithNonTranslationDomainParentBeingTranslationDomainDefault() + public function testNonTranslationDomainFormWithNonTranslationDomainParentBeingTranslationDomainDefault() { $parent = $this->factory->createNamed('parent', 'form'); $child = $this->factory->createNamed('child', 'form'); @@ -645,4 +645,18 @@ class FormTypeTest extends TypeTestCase $this->assertSame('default', $form->getData()); } + + public function testNormDataIsPassedToView() + { + $view = $this->factory->createBuilder('form') + ->addViewTransformer(new FixedDataTransformer(array( + 'foo' => 'bar', + ))) + ->setData('foo') + ->getForm() + ->createView(); + + $this->assertSame('foo', $view->vars['data']); + $this->assertSame('bar', $view->vars['value']); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php index 399ae6e..62ddae7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php @@ -23,11 +23,11 @@ class LanguageTypeTest extends LocalizedTestCase $view = $form->createView(); $choices = $view->vars['choices']; - $this->assertContains(new ChoiceView('en', 'Englisch'), $choices, '', false, false); - $this->assertContains(new ChoiceView('en_GB', 'Britisches Englisch'), $choices, '', false, false); - $this->assertContains(new ChoiceView('en_US', 'Amerikanisches Englisch'), $choices, '', false, false); - $this->assertContains(new ChoiceView('fr', 'Französisch'), $choices, '', false, false); - $this->assertContains(new ChoiceView('my', 'Birmanisch'), $choices, '', false, false); + $this->assertContains(new ChoiceView('en', 'en', 'Englisch'), $choices, '', false, false); + $this->assertContains(new ChoiceView('en_GB', 'en_GB', 'Britisches Englisch'), $choices, '', false, false); + $this->assertContains(new ChoiceView('en_US', 'en_US', 'Amerikanisches Englisch'), $choices, '', false, false); + $this->assertContains(new ChoiceView('fr', 'fr', 'Französisch'), $choices, '', false, false); + $this->assertContains(new ChoiceView('my', 'my', 'Birmanisch'), $choices, '', false, false); } public function testMultipleLanguagesIsNotIncluded() @@ -36,6 +36,6 @@ class LanguageTypeTest extends LocalizedTestCase $view = $form->createView(); $choices = $view->vars['choices']; - $this->assertNotContains(new ChoiceView('mul', 'Mehrsprachig'), $choices, '', false, false); + $this->assertNotContains(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices, '', false, false); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php index 4c2e195..d02d2ba 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php @@ -23,8 +23,8 @@ class LocaleTypeTest extends LocalizedTestCase $view = $form->createView(); $choices = $view->vars['choices']; - $this->assertContains(new ChoiceView('en', 'Englisch'), $choices, '', false, false); - $this->assertContains(new ChoiceView('en_GB', 'Englisch (Vereinigtes Königreich)'), $choices, '', false, false); - $this->assertContains(new ChoiceView('zh_Hant_MO', 'Chinesisch (traditionell, Sonderverwaltungszone Macao)'), $choices, '', false, false); + $this->assertContains(new ChoiceView('en', 'en', 'Englisch'), $choices, '', false, false); + $this->assertContains(new ChoiceView('en_GB', 'en_GB', 'Englisch (Vereinigtes Königreich)'), $choices, '', false, false); + $this->assertContains(new ChoiceView('zh_Hant_MO', 'zh_Hant_MO', 'Chinesisch (traditionell, Sonderverwaltungszone Macao)'), $choices, '', false, false); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php index 1c0cf3c..fa644e5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php @@ -49,7 +49,7 @@ class RepeatedTypeTest extends TypeTestCase public function testSetOptionsPerChild() { $form = $this->factory->create('repeated', null, array( - // the global required value cannot be overriden + // the global required value cannot be overridden 'type' => 'text', 'first_options' => array('label' => 'Test', 'required' => false), 'second_options' => array('label' => 'Test2') diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php index 24873d2..5c0d960 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php @@ -244,8 +244,8 @@ class TimeTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('6', '06'), - new ChoiceView('7', '07'), + new ChoiceView('6', '6', '06'), + new ChoiceView('7', '7', '07'), ), $view['hour']->vars['choices']); } @@ -258,8 +258,8 @@ class TimeTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('6', '06'), - new ChoiceView('7', '07'), + new ChoiceView('6', '6', '06'), + new ChoiceView('7', '7', '07'), ), $view['minute']->vars['choices']); } @@ -273,8 +273,8 @@ class TimeTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals(array( - new ChoiceView('6', '06'), - new ChoiceView('7', '07'), + new ChoiceView('6', '6', '06'), + new ChoiceView('7', '7', '07'), ), $view['second']->vars['choices']); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php index 113b8d7..fcb8c7e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php @@ -22,9 +22,9 @@ class TimezoneTypeTest extends TypeTestCase $choices = $view->vars['choices']; $this->assertArrayHasKey('Africa', $choices); - $this->assertContains(new ChoiceView('Africa/Kinshasa', 'Kinshasa'), $choices['Africa'], '', false, false); + $this->assertContains(new ChoiceView('Africa/Kinshasa', 'Africa/Kinshasa', 'Kinshasa'), $choices['Africa'], '', false, false); $this->assertArrayHasKey('America', $choices); - $this->assertContains(new ChoiceView('America/New_York', 'New York'), $choices['America'], '', false, false); + $this->assertContains(new ChoiceView('America/New_York', 'America/New_York', 'New York'), $choices['America'], '', false, false); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php similarity index 91% rename from vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php rename to vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php index a3d235f..bfb9afa 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; +namespace Symfony\Component\Form\Tests\Extension\HttpFoundation\EventListener; -use Symfony\Component\Form\Extension\Core\EventListener\BindRequestListener; +use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener; use Symfony\Component\Form\Form; -use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormConfigBuilder; use Symfony\Component\Form\FormEvent; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\File\UploadedFile; @@ -96,7 +96,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase )); $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfig('author', null, $dispatcher); + $config = new FormConfigBuilder('author', null, $dispatcher); $form = new Form($config); $event = new FormEvent($form, $request); @@ -123,7 +123,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase )); $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfig('', null, $dispatcher); + $config = new FormConfigBuilder('', null, $dispatcher); $form = new Form($config); $event = new FormEvent($form, $request); @@ -150,7 +150,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase )); $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfig('author', null, $dispatcher); + $config = new FormConfigBuilder('author', null, $dispatcher); $config->setCompound(true); $config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface')); $form = new Form($config); @@ -177,7 +177,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase )); $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfig('author', null, $dispatcher); + $config = new FormConfigBuilder('author', null, $dispatcher); $config->setCompound(false); $form = new Form($config); $event = new FormEvent($form, $request); @@ -201,7 +201,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase )); $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfig('author', null, $dispatcher); + $config = new FormConfigBuilder('author', null, $dispatcher); $form = new Form($config); $event = new FormEvent($form, $request); @@ -225,7 +225,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase )); $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfig('', null, $dispatcher); + $config = new FormConfigBuilder('', null, $dispatcher); $form = new Form($config); $event = new FormEvent($form, $request); @@ -249,7 +249,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase )); $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfig('author', null, $dispatcher); + $config = new FormConfigBuilder('author', null, $dispatcher); $config->setCompound(true); $config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface')); $form = new Form($config); @@ -272,7 +272,7 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase )); $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $config = new FormConfig('author', null, $dispatcher); + $config = new FormConfigBuilder('author', null, $dispatcher); $config->setCompound(false); $form = new Form($config); $event = new FormEvent($form, $request); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index 03872b2..77767d2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -15,7 +15,7 @@ use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Form; -use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormConfigBuilder; use Symfony\Component\Form\FormError; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\Validator\ConstraintViolation; @@ -67,7 +67,7 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase protected function getForm($name = 'name', $propertyPath = null, $dataClass = null, $errorMapping = array(), $virtual = false, $synchronized = true) { - $config = new FormConfig($name, $dataClass, $this->dispatcher, array( + $config = new FormConfigBuilder($name, $dataClass, $this->dispatcher, array( 'error_mapping' => $errorMapping, )); $config->setMapped(true); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php new file mode 100644 index 0000000..e53d19f --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php @@ -0,0 +1,27 @@ +getFormFactory(); + + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($formFactory) { + $form = $event->getForm(); + $type = $form->getName() % 2 === 0 ? 'text' : 'textarea'; + $form->add($formFactory->createNamed('title', $type)); + }); + } + + public function getName() + { + return 'alternating_row'; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormConfigTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormConfigTest.php index 5896dc5..e11561a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormConfigTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormConfigTest.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Form\Tests; /** * @author Bernhard Schussek */ -use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormConfigBuilder; class FormConfigTest extends \PHPUnit_Framework_TestCase { @@ -64,7 +64,7 @@ class FormConfigTest extends \PHPUnit_Framework_TestCase $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); try { - new FormConfig($name, null, $dispatcher); + new FormConfigBuilder($name, null, $dispatcher); if (!$accepted) { $this->fail(sprintf('The value "%s" should not be accepted', $name)); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php index 6165fb9..0cbf54c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php @@ -44,6 +44,11 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase */ private $registry; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $resolvedTypeFactory; + /** * @var FormFactory */ @@ -55,10 +60,11 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('The "EventDispatcher" component is not available'); } + $this->resolvedTypeFactory = $this->getMock('Symfony\Component\Form\ResolvedFormTypeFactoryInterface'); $this->guesser1 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface'); $this->guesser2 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface'); $this->registry = $this->getMock('Symfony\Component\Form\FormRegistryInterface'); - $this->factory = new FormFactory($this->registry); + $this->factory = new FormFactory($this->registry, $this->resolvedTypeFactory); $this->registry->expects($this->any()) ->method('getTypeGuesser') @@ -73,8 +79,8 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase $type = new FooType(); $resolvedType = $this->getMockResolvedType(); - $this->registry->expects($this->once()) - ->method('resolveType') + $this->resolvedTypeFactory->expects($this->once()) + ->method('createResolvedType') ->with($type) ->will($this->returnValue($resolvedType)); @@ -136,16 +142,11 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase $type = $this->getMockType(); $resolvedType = $this->getMockResolvedType(); - $this->registry->expects($this->once()) - ->method('resolveType') + $this->resolvedTypeFactory->expects($this->once()) + ->method('createResolvedType') ->with($type) ->will($this->returnValue($resolvedType)); - // The type is also implicitely added to the registry - $this->registry->expects($this->once()) - ->method('addType') - ->with($resolvedType); - $resolvedType->expects($this->once()) ->method('createBuilder') ->with($this->factory, 'name', $options) @@ -159,11 +160,6 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase $options = array('a' => '1', 'b' => '2'); $resolvedType = $this->getMockResolvedType(); - // The type is also implicitely added to the registry - $this->registry->expects($this->once()) - ->method('addType') - ->with($resolvedType); - $resolvedType->expects($this->once()) ->method('createBuilder') ->with($this->factory, 'name', $options) @@ -555,7 +551,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase { return $this->getMockBuilder('Symfony\Component\Form\FormFactory') ->setMethods($methods) - ->setConstructorArgs(array($this->registry)) + ->setConstructorArgs(array($this->registry, $this->resolvedTypeFactory)) ->getMock(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php index fa03a40..bdb93e1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Tests; use Symfony\Component\Form\FormFactory; +use Symfony\Component\Form\ResolvedFormTypeFactory; use Symfony\Component\Form\FormRegistry; use Symfony\Component\Form\Extension\Core\CoreExtension; @@ -20,6 +21,11 @@ use Symfony\Component\Form\Extension\Core\CoreExtension; */ class FormIntegrationTestCase extends \PHPUnit_Framework_TestCase { + /** + * @var ResolvedFormTypeFactory + */ + protected $resolvedTypeFactory; + /** * @var FormRegistry */ @@ -36,8 +42,9 @@ class FormIntegrationTestCase extends \PHPUnit_Framework_TestCase $this->markTestSkipped('The "EventDispatcher" component is not available'); } - $this->registry = new FormRegistry($this->getExtensions()); - $this->factory = new FormFactory($this->registry); + $this->resolvedTypeFactory = new ResolvedFormTypeFactory(); + $this->registry = new FormRegistry($this->getExtensions(), $this->resolvedTypeFactory); + $this->factory = new FormFactory($this->registry, $this->resolvedTypeFactory); } protected function getExtensions() diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormRegistryTest.php index ae0946f..e0a22da 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormRegistryTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormRegistryTest.php @@ -27,6 +27,11 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase */ private $registry; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $resolvedTypeFactory; + /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -49,6 +54,7 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase protected function setUp() { + $this->resolvedTypeFactory = $this->getMock('Symfony\Component\Form\ResolvedFormTypeFactory'); $this->guesser1 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface'); $this->guesser2 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface'); $this->extension1 = new TestExtension($this->guesser1); @@ -56,53 +62,16 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase $this->registry = new FormRegistry(array( $this->extension1, $this->extension2, - )); - } - - public function testResolveType() - { - $type = new FooType(); - $ext1 = new FooTypeBarExtension(); - $ext2 = new FooTypeBazExtension(); - - $this->extension1->addTypeExtension($ext1); - $this->extension2->addTypeExtension($ext2); - - $resolvedType = $this->registry->resolveType($type); - - $this->assertEquals($type, $resolvedType->getInnerType()); - $this->assertEquals(array($ext1, $ext2), $resolvedType->getTypeExtensions()); - } - - public function testResolveTypeConnectsParent() - { - $parentType = new FooType(); - $type = new FooSubType(); - - $resolvedParentType = $this->registry->resolveType($parentType); - - $this->registry->addType($resolvedParentType); - - $resolvedType = $this->registry->resolveType($type); - - $this->assertSame($resolvedParentType, $resolvedType->getParent()); - } - - /** - * @expectedException Symfony\Component\Form\Exception\FormException - */ - public function testResolveTypeThrowsExceptionIfParentNotFound() - { - $type = new FooSubType(); - - $this->registry->resolveType($type); + ), $this->resolvedTypeFactory); } public function testGetTypeReturnsAddedType() { - $type = new FooType(); + $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); - $resolvedType = $this->registry->resolveType($type); + $resolvedType->expects($this->any()) + ->method('getName') + ->will($this->returnValue('foo')); $this->registry->addType($resolvedType); @@ -112,13 +81,88 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase public function testGetTypeFromExtension() { $type = new FooType(); + $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); $this->extension2->addType($type); + $this->resolvedTypeFactory->expects($this->once()) + ->method('createResolvedType') + ->with($type) + ->will($this->returnValue($resolvedType)); + + $resolvedType->expects($this->any()) + ->method('getName') + ->will($this->returnValue('foo')); + $resolvedType = $this->registry->getType('foo'); - $this->assertInstanceOf('Symfony\Component\Form\ResolvedFormTypeInterface', $resolvedType); - $this->assertSame($type, $resolvedType->getInnerType()); + $this->assertSame($resolvedType, $this->registry->getType('foo')); + } + + public function testGetTypeWithTypeExtensions() + { + $type = new FooType(); + $ext1 = new FooTypeBarExtension(); + $ext2 = new FooTypeBazExtension(); + $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); + + $this->extension2->addType($type); + $this->extension1->addTypeExtension($ext1); + $this->extension2->addTypeExtension($ext2); + + $this->resolvedTypeFactory->expects($this->once()) + ->method('createResolvedType') + ->with($type, array($ext1, $ext2)) + ->will($this->returnValue($resolvedType)); + + $resolvedType->expects($this->any()) + ->method('getName') + ->will($this->returnValue('foo')); + + $this->assertSame($resolvedType, $this->registry->getType('foo')); + } + + public function testGetTypeConnectsParent() + { + $parentType = new FooType(); + $type = new FooSubType(); + $parentResolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); + $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); + + $this->extension1->addType($parentType); + $this->extension2->addType($type); + + $this->resolvedTypeFactory->expects($this->at(0)) + ->method('createResolvedType') + ->with($parentType) + ->will($this->returnValue($parentResolvedType)); + + $this->resolvedTypeFactory->expects($this->at(1)) + ->method('createResolvedType') + ->with($type, array(), $parentResolvedType) + ->will($this->returnValue($resolvedType)); + + $parentResolvedType->expects($this->any()) + ->method('getName') + ->will($this->returnValue('foo')); + + $resolvedType->expects($this->any()) + ->method('getName') + ->will($this->returnValue('foo_sub_type')); + + $this->assertSame($resolvedType, $this->registry->getType('foo_sub_type')); + } + + /** + * @expectedException Symfony\Component\Form\Exception\FormException + */ + public function testGetTypeThrowsExceptionIfParentNotFound() + { + $type = new FooSubType(); + + $this->extension1->addType($type); + + $this->registry->getType($type); } /** @@ -139,9 +183,11 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase public function testHasTypeAfterAdding() { - $type = new FooType(); + $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); - $resolvedType = $this->registry->resolveType($type); + $resolvedType->expects($this->any()) + ->method('getName') + ->will($this->returnValue('foo')); $this->assertFalse($this->registry->hasType('foo')); @@ -153,6 +199,16 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase public function testHasTypeAfterLoadingFromExtension() { $type = new FooType(); + $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); + + $this->resolvedTypeFactory->expects($this->once()) + ->method('createResolvedType') + ->with($type) + ->will($this->returnValue($resolvedType)); + + $resolvedType->expects($this->any()) + ->method('getName') + ->will($this->returnValue('foo')); $this->assertFalse($this->registry->hasType('foo')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php index 2aded4f..e543de5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Form\Tests; use Symfony\Component\Form\ResolvedFormType; use Symfony\Component\Form\FormView; use Symfony\Component\Form\FormBuilder; -use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormConfigBuilder; use Symfony\Component\Form\Form; use Symfony\Component\OptionsResolver\OptionsResolverInterface; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php index afebeda..2ca9c26 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -15,7 +15,7 @@ use Symfony\Component\Form\Form; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\Util\PropertyPath; -use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormConfigBuilder; use Symfony\Component\Form\FormView; use Symfony\Component\Form\FormError; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -34,7 +34,7 @@ class SimpleFormTest extends AbstractFormTest 'foo' => 'bar', )); - $config = new FormConfig('name', null, $this->dispatcher); + $config = new FormConfigBuilder('name', null, $this->dispatcher); $config->addViewTransformer($view); $config->addModelTransformer($model); $config->setData('default'); @@ -45,6 +45,28 @@ class SimpleFormTest extends AbstractFormTest $this->assertSame('bar', $form->getViewData()); } + // https://github.com/symfony/symfony/commit/d4f4038f6daf7cf88ca7c7ab089473cce5ebf7d8#commitcomment-1632879 + public function testDataIsInitializedFromBind() + { + $mock = $this->getMockBuilder('\stdClass') + ->setMethods(array('preSetData', 'preBind')) + ->getMock(); + $mock->expects($this->at(0)) + ->method('preSetData'); + $mock->expects($this->at(1)) + ->method('preBind'); + + $config = new FormConfigBuilder('name', null, $this->dispatcher); + $config->addEventListener(FormEvents::PRE_SET_DATA, array($mock, 'preSetData')); + $config->addEventListener(FormEvents::PRE_BIND, array($mock, 'preBind')); + $form = new Form($config); + + // no call to setData() or similar where the object would be + // initialized otherwise + + $form->bind('foobar'); + } + /** * @expectedException Symfony\Component\Form\Exception\AlreadyBoundException */ @@ -694,7 +716,7 @@ class SimpleFormTest extends AbstractFormTest */ public function testViewDataMustNotBeObjectIfDataClassIsNull() { - $config = new FormConfig('name', null, $this->dispatcher); + $config = new FormConfigBuilder('name', null, $this->dispatcher); $config->addViewTransformer(new FixedDataTransformer(array( '' => '', 'foo' => new \stdClass(), @@ -707,7 +729,7 @@ class SimpleFormTest extends AbstractFormTest public function testViewDataMayBeArrayAccessIfDataClassIsNull() { $arrayAccess = $this->getMock('\ArrayAccess'); - $config = new FormConfig('name', null, $this->dispatcher); + $config = new FormConfigBuilder('name', null, $this->dispatcher); $config->addViewTransformer(new FixedDataTransformer(array( '' => '', 'foo' => $arrayAccess, @@ -724,7 +746,7 @@ class SimpleFormTest extends AbstractFormTest */ public function testViewDataMustBeObjectIfDataClassIsSet() { - $config = new FormConfig('name', 'stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher); $config->addViewTransformer(new FixedDataTransformer(array( '' => '', 'foo' => array('bar' => 'baz'), @@ -740,7 +762,7 @@ class SimpleFormTest extends AbstractFormTest public function testSetDataCannotInvokeItself() { // Cycle detection to prevent endless loops - $config = new FormConfig('name', 'stdClass', $this->dispatcher); + $config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher); $config->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { $event->getForm()->setData('bar'); }); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php index 6d2c896..482d7eb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php @@ -587,9 +587,9 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface * Searches for add and remove methods. * * @param \ReflectionClass $reflClass The reflection class for the given object - * @param string|null $singular The singular form of the property name or null. + * @param string|null $singulars The singular form of the property name or null. * - * @return array|null An array containin the adder and remover when found, null otherwise. + * @return array|null An array containing the adder and remover when found, null otherwise. * * @throws InvalidPropertyException If the property does not exist. */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RedirectResponse.php index f2e854e..a9d98e6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -39,24 +39,9 @@ class RedirectResponse extends Response throw new \InvalidArgumentException('Cannot redirect to an empty URL.'); } - $this->targetUrl = $url; + parent::__construct('', $status, $headers); - parent::__construct( - sprintf(' - - - - - - Redirecting to %1$s - - - Redirecting to %1$s. - -', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')), - $status, - array_merge($headers, array('Location' => $url)) - ); + $this->setTargetUrl($url); if (!$this->isRedirect()) { throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); @@ -80,4 +65,38 @@ class RedirectResponse extends Response { return $this->targetUrl; } + + /** + * Sets the redirect target of this response. + * + * @param string $url The URL to redirect to + * + * @return RedirectResponse The current response. + */ + public function setTargetUrl($url) + { + if (empty($url)) { + throw new \InvalidArgumentException('Cannot redirect to an empty URL.'); + } + + $this->targetUrl = $url; + + $this->setContent( + sprintf(' + + + + + + Redirecting to %1$s + + + Redirecting to %1$s. + +', htmlspecialchars($url, ENT_QUOTES, 'UTF-8'))); + + $this->headers->set('Location', $url); + + return $this; + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php index 8d681a9..848c3d1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php @@ -515,7 +515,7 @@ class Request * * slow * * prefer to get from a "named" source * - * It is better to explicity get request parameters from the appropriate + * It is better to explicitly get request parameters from the appropriate * public property instead (query, request, attributes, ...). * * @param string $key the key diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcher.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcher.php index 072c520..2982952 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -202,7 +202,16 @@ class RequestMatcher implements RequestMatcherInterface throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); } - list($address, $netmask) = explode('/', $ip, 2); + if (false !== strpos($ip, '/')) { + list($address, $netmask) = explode('/', $ip, 2); + + if ($netmask < 1 || $netmask > 128) { + return false; + } + } else { + $address = $ip; + $netmask = 128; + } $bytesAddr = unpack("n*", inet_pton($address)); $bytesTest = unpack("n*", inet_pton($requestIp)); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php index 7ab2014..dbc82d1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php @@ -303,9 +303,12 @@ class Response // ob_get_level() never returns 0 on some Windows configurations, so if // the level is the same two times in a row, the loop should be stopped. $previous = null; + $obStatus = ob_get_status(1); while (($level = ob_get_level()) > 0 && $level !== $previous) { $previous = $level; - ob_end_flush(); + if ($obStatus[$level - 1] && isset($obStatus[$level - 1]['del']) && $obStatus[$level - 1]['del']) { + ob_end_flush(); + } } flush(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index ec753ec..ecc68ad 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -173,7 +173,7 @@ class NativeSessionStorage implements SessionStorageInterface */ public function setId($id) { - return $this->saveHandler->setId($id); + $this->saveHandler->setId($id); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php index 179ee5a..b55c3b6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php @@ -40,6 +40,14 @@ class RedirectResponseTest extends \PHPUnit_Framework_TestCase $this->assertEquals('foo.bar', $response->getTargetUrl()); } + public function testSetTargetUrl() + { + $response = new RedirectResponse('foo.bar'); + $response->setTargetUrl('baz.beep'); + + $this->assertEquals('baz.beep', $response->getTargetUrl()); + } + public function testCreate() { $response = RedirectResponse::create('foo', 301); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php index e165987..32ca1e5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php @@ -62,6 +62,9 @@ class RequestMatcherTest extends \PHPUnit_Framework_TestCase return array( array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), array(false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), + array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'), + array(true, '0:0:0:0:0:0:0:1', '::1'), + array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'), ); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php index 07b2780..80e250a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php @@ -60,7 +60,7 @@ class RouterDataCollector extends DataCollector /** * Remembers the controller associated to each request. * - * @param FilterControllerEvent The filter controller event + * @param FilterControllerEvent $event The filter controller event */ public function onKernelController(FilterControllerEvent $event) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php index 848f3cc..c0133d4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php @@ -43,7 +43,7 @@ class ExceptionHandler /** * Register the exception handler. * - * @return The registered exception handler + * @return ExceptionHandler The registered exception handler */ public static function register($debug = true) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Event/PostResponseEvent.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Event/PostResponseEvent.php index 6848f78..caa7b9f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Event/PostResponseEvent.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Event/PostResponseEvent.php @@ -61,7 +61,7 @@ class PostResponseEvent extends Event } /** - * Returns the reponse for which this event was thrown. + * Returns the response for which this event was thrown. * * @return Response */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelEvents.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelEvents.php index c2a4309..fce48ac 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelEvents.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelEvents.php @@ -93,7 +93,7 @@ final class KernelEvents const RESPONSE = 'kernel.response'; /** - * The TERMINATE event occurs once a reponse was sent + * The TERMINATE event occurs once a response was sent * * This event allows you to run expensive post-response jobs. * The event listener method receives a diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index dfab9a6..94052f8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -205,7 +205,7 @@ class FileProfilerStorage implements ProfilerStorageInterface * * @param resource $file The file resource, with the pointer placed at the end of the line to read * - * @return mixed A string representating the line or FALSE if beginning of file is reached + * @return mixed A string representing the line or FALSE if beginning of file is reached */ protected function readLineFromFile($file) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php index ec8ad1f..51c9f9c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php @@ -370,7 +370,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface /** * Removes the specified keys. * - * @param array $key + * @param array $keys * * @return Boolean */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntl.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntl.php index b89e52f..07e45b8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntl.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntl.php @@ -104,6 +104,8 @@ abstract class StubIntl /** * Returns the symbolic name for a given error code * + * @param integer $code The error code returned by StubIntl::getErrorCode() + * * @return string */ public static function getErrorName($code) diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/LazyOption.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/LazyOption.php deleted file mode 100644 index fbe700a..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/LazyOption.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\OptionsResolver; - -/** - * An option that is evaluated lazily using a closure. - * - * @author Bernhard Schussek - */ -class LazyOption -{ - /** - * The underlying closure. - * @var \Closure - */ - private $closure; - - /** - * The previous default value of the option. - * @var mixed - */ - private $previousValue; - - /** - * Creates a new lazy option. - * - * @param \Closure $closure The closure used for initializing the - * option value. - * @param mixed $previousValue The previous value of the option. This - * value is passed to the closure when it is - * evaluated. - * - * @see evaluate() - */ - public function __construct(\Closure $closure, $previousValue = null) - { - $this->closure = $closure; - $this->previousValue = $previousValue; - } - - /** - * Evaluates the underlying closure and returns its result. - * - * The given Options instance is passed to the closure as first argument. - * The previous default value set in the constructor is passed as second - * argument. - * - * @param Options $options The container with all concrete options. - * - * @return mixed The result of the closure. - */ - public function evaluate(Options $options) - { - $previousValue = $this->previousValue; - $closure = $this->closure; - - if ($previousValue instanceof self) { - $previousValue = $this->previousValue->evaluate($options); - } - - // Performs a bit better than __invoke() and call_user_func() - return $closure($options, $previousValue); - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Options.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Options.php index 575faa0..ef10a19 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Options.php +++ b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Options.php @@ -21,19 +21,25 @@ use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; class Options implements \ArrayAccess, \Iterator, \Countable { /** - * A list of option values and LazyOption instances. + * A list of option values. * @var array */ private $options = array(); /** - * A list storing the names of all LazyOption instances as keys. + * A list of normalizer closures. + * @var array + */ + private $normalizers = array(); + + /** + * A list of closures for evaluating lazy options. * @var array */ private $lazy = array(); /** - * A list of Boolean locks for each LazyOption. + * A list containing the currently locked options. * @var array */ private $lock = array(); @@ -83,10 +89,40 @@ class Options implements \ArrayAccess, \Iterator, \Countable // Setting is equivalent to overloading while discarding the previous // option value unset($this->options[$option]); + unset($this->lazy[$option]); $this->overload($option, $value); } + /** + * Sets the normalizer for a given option. + * + * Normalizers should be closures with the following signature: + * + * + * function (Options $options, $value) + * + * + * This closure will be evaluated once the option is read using + * {@link get()}. The closure has access to the resolved values of + * other options through the passed {@link Options} instance. + * + * @param string $option The name of the option. + * @param \Closure $normalizer The normalizer. + * + * @throws OptionDefinitionException If options have already been read. + * Once options are read, the container + * becomes immutable. + */ + public function setNormalizer($option, \Closure $normalizer) + { + if ($this->reading) { + throw new OptionDefinitionException('Normalizers cannot be added anymore once options have been read.'); + } + + $this->normalizers[$option] = $normalizer; + } + /** * Replaces the contents of the container with the given options. * @@ -106,9 +142,10 @@ class Options implements \ArrayAccess, \Iterator, \Countable } $this->options = array(); + $this->lazy = array(); foreach ($options as $option => $value) { - $this->set($option, $value); + $this->overload($option, $value); } } @@ -140,29 +177,30 @@ class Options implements \ArrayAccess, \Iterator, \Countable } // If an option is a closure that should be evaluated lazily, store it - // inside a LazyOption instance. + // in the "lazy" property. if ($value instanceof \Closure) { $reflClosure = new \ReflectionFunction($value); $params = $reflClosure->getParameters(); if (isset($params[0]) && null !== ($class = $params[0]->getClass()) && __CLASS__ === $class->name) { - $currentValue = isset($this->options[$option]) ? $this->options[$option] : null; - $value = new LazyOption($value, $currentValue); + // Initialize the option if no previous value exists + if (!isset($this->options[$option])) { + $this->options[$option] = null; + } - // Store locks for lazy options to detect cyclic dependencies - $this->lock[$option] = false; + // Ignore previous lazy options if the closure has no second parameter + if (!isset($this->lazy[$option]) || !isset($params[1])) { + $this->lazy[$option] = array(); + } - // Store which options are lazy for more efficient resolving - $this->lazy[$option] = true; - - $this->options[$option] = $value; + // Store closure for later evaluation + $this->lazy[$option][] = $value; return; } } - // Reset lazy flag and locks by default - unset($this->lock[$option]); + // Remove lazy options by default unset($this->lazy[$option]); $this->options[$option] = $value; @@ -193,6 +231,10 @@ class Options implements \ArrayAccess, \Iterator, \Countable $this->resolve($option); } + if (isset($this->normalizers[$option])) { + $this->normalize($option); + } + return $this->options[$option]; } @@ -205,7 +247,7 @@ class Options implements \ArrayAccess, \Iterator, \Countable */ public function has($option) { - return isset($this->options[$option]); + return array_key_exists($option, $this->options); } /** @@ -224,8 +266,8 @@ class Options implements \ArrayAccess, \Iterator, \Countable } unset($this->options[$option]); - unset($this->lock[$option]); unset($this->lazy[$option]); + unset($this->normalizers[$option]); } /** @@ -242,8 +284,8 @@ class Options implements \ArrayAccess, \Iterator, \Countable } $this->options = array(); - $this->lock = array(); $this->lazy = array(); + $this->normalizers = array(); } /** @@ -257,19 +299,22 @@ class Options implements \ArrayAccess, \Iterator, \Countable { $this->reading = true; - // Create a copy because resolve() modifies the array - $lazy = $this->lazy; - // Performance-wise this is slightly better than // while (null !== $option = key($this->lazy)) - foreach ($lazy as $option => $isLazy) { - // When resolve() is called, potentially multiple lazy options - // are evaluated, so check again if the option is still lazy. + foreach ($this->lazy as $option => $closures) { + // Double check, in case the option has already been resolved + // by cascade in the previous cycles if (isset($this->lazy[$option])) { $this->resolve($option); } } + foreach ($this->normalizers as $option => $normalizer) { + if (isset($this->normalizers[$option])) { + $this->normalize($option); + } + } + return $this->options; } @@ -388,7 +433,7 @@ class Options implements \ArrayAccess, \Iterator, \Countable } /** - * Evaluates the given option if it is a lazy option. + * Evaluates the given lazy option. * * The evaluated value is written into the options array. The closure for * evaluating the option is discarded afterwards. @@ -400,7 +445,11 @@ class Options implements \ArrayAccess, \Iterator, \Countable */ private function resolve($option) { - if ($this->lock[$option]) { + // The code duplication with normalize() exists for performance + // reasons, in order to save a method call. + // Remember that this method is potentially called a couple of thousand + // times and needs to be as efficient as possible. + if (isset($this->lock[$option])) { $conflicts = array(); foreach ($this->lock as $option => $locked) { @@ -413,10 +462,51 @@ class Options implements \ArrayAccess, \Iterator, \Countable } $this->lock[$option] = true; - $this->options[$option] = $this->options[$option]->evaluate($this); - $this->lock[$option] = false; + foreach ($this->lazy[$option] as $closure) { + $this->options[$option] = $closure($this, $this->options[$option]); + } + unset($this->lock[$option]); // The option now isn't lazy anymore unset($this->lazy[$option]); } + + /** + * Normalizes the given option. + * + * The evaluated value is written into the options array. + * + * @param string $option The option to normalizer. + * + * @throws OptionDefinitionException If the option has a cyclic dependency + * on another option. + */ + private function normalize($option) + { + // The code duplication with resolve() exists for performance + // reasons, in order to save a method call. + // Remember that this method is potentially called a couple of thousand + // times and needs to be as efficient as possible. + if (isset($this->lock[$option])) { + $conflicts = array(); + + foreach ($this->lock as $option => $locked) { + if ($locked) { + $conflicts[] = $option; + } + } + + throw new OptionDefinitionException('The options "' . implode('", "', $conflicts) . '" have a cyclic dependency.'); + } + + /** @var \Closure $normalizer */ + $normalizer = $this->normalizers[$option]; + + $this->lock[$option] = true; + $this->options[$option] = $normalizer($this, $this->options[$option]); + unset($this->lock[$option]); + + // The option is now normalized + unset($this->normalizers[$option]); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php index fdddad6..20ec7af 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php +++ b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -53,12 +53,6 @@ class OptionsResolver implements OptionsResolverInterface */ private $allowedTypes = array(); - /** - * A list of normalizers transforming each resolved options. - * @var array - */ - private $normalizers = array(); - /** * Creates a new instance. */ @@ -194,7 +188,9 @@ class OptionsResolver implements OptionsResolverInterface { $this->validateOptionsExistence($normalizers); - $this->normalizers = array_replace($this->normalizers, $normalizers); + foreach ($normalizers as $option => $normalizer) { + $this->defaultOptions->setNormalizer($option, $normalizer); + } return $this; } @@ -231,11 +227,6 @@ class OptionsResolver implements OptionsResolverInterface $combinedOptions->set($option, $value); } - // Apply filters - foreach ($this->normalizers as $option => $filter) { - $combinedOptions->overload($option, $filter); - } - // Resolve options $resolvedOptions = $combinedOptions->all(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/LazyOptionTest.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/LazyOptionTest.php deleted file mode 100644 index 48b15ce..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/LazyOptionTest.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\OptionsResolver\Tests; - -use Symfony\Component\OptionsResolver\LazyOption; -use Symfony\Component\OptionsResolver\Options; - -/** - * @author Bernhard Schussek - */ -class LazyOptionTest extends \PHPUnit_Framework_TestCase -{ - public function testDontCacheEvaluatedPreviousValue() - { - $previousValue = new LazyOption(function (Options $options) { - return $options['foo']; - }); - - $lazyOption = new LazyOption(function (Options $options, $previousValue) { - return $previousValue; - }, $previousValue); - - // If provided with two different option sets, two different results - // should be returned - $options1 = new Options(); - $options1['foo'] = 'bar'; - - $this->assertSame('bar', $lazyOption->evaluate($options1)); - - $options2 = new Options(); - $options2['foo'] = 'boo'; - - $this->assertSame('boo', $lazyOption->evaluate($options2)); - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php index ca0872f..e151051 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php @@ -79,6 +79,16 @@ class OptionsTest extends \PHPUnit_Framework_TestCase $this->options->remove('foo'); } + /** + * @expectedException Symfony\Component\OptionsResolver\Exception\OptionDefinitionException + */ + public function testSetNormalizerNotSupportedAfterGet() + { + $this->options->set('foo', 'bar'); + $this->options->get('foo'); + $this->options->setNormalizer('foo', function () {}); + } + public function testSetLazyOption() { $test = $this; @@ -146,6 +156,23 @@ class OptionsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('dynamic', $this->options->get('foo')); } + public function testPreviousValueIsNotEvaluatedIfNoSecondArgument() + { + $test = $this; + + // defined by superclass + $this->options->set('foo', function (Options $options) use ($test) { + $test->fail('Should not be called'); + }); + + // defined by subclass, no $previousValue argument defined! + $this->options->overload('foo', function (Options $options) use ($test) { + return 'dynamic'; + }); + + $this->assertEquals('dynamic', $this->options->get('foo')); + } + public function testLazyOptionCanAccessOtherOptions() { $test = $this; @@ -182,6 +209,66 @@ class OptionsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('dynamic', $this->options->get('bam')); } + public function testNormalizer() + { + $this->options->set('foo', 'bar'); + + $this->options->setNormalizer('foo', function () { + return 'normalized'; + }); + + $this->assertEquals('normalized', $this->options->get('foo')); + } + + public function testNormalizerReceivesUnnormalizedValue() + { + $this->options->set('foo', 'bar'); + + $this->options->setNormalizer('foo', function (Options $options, $value) { + return 'normalized[' . $value . ']'; + }); + + $this->assertEquals('normalized[bar]', $this->options->get('foo')); + } + + public function testNormalizerCanAccessOtherOptions() + { + $test = $this; + + $this->options->set('foo', 'bar'); + $this->options->set('bam', 'baz'); + + $this->options->setNormalizer('bam', function (Options $options) use ($test) { + /* @var \PHPUnit_Framework_TestCase $test */ + $test->assertEquals('bar', $options->get('foo')); + + return 'normalized'; + }); + + $this->assertEquals('bar', $this->options->get('foo')); + $this->assertEquals('normalized', $this->options->get('bam')); + } + + public function testNormalizerCanAccessOtherLazyOptions() + { + $test = $this; + + $this->options->set('foo', function (Options $options) { + return 'bar'; + }); + $this->options->set('bam', 'baz'); + + $this->options->setNormalizer('bam', function (Options $options) use ($test) { + /* @var \PHPUnit_Framework_TestCase $test */ + $test->assertEquals('bar', $options->get('foo')); + + return 'normalized'; + }); + + $this->assertEquals('bar', $this->options->get('foo')); + $this->assertEquals('normalized', $this->options->get('bam')); + } + /** * @expectedException Symfony\Component\OptionsResolver\Exception\OptionDefinitionException */ @@ -198,6 +285,85 @@ class OptionsTest extends \PHPUnit_Framework_TestCase $this->options->get('foo'); } + /** + * @expectedException Symfony\Component\OptionsResolver\Exception\OptionDefinitionException + */ + public function testFailForCyclicDependenciesBetweenNormalizers() + { + $this->options->set('foo', 'bar'); + $this->options->set('bam', 'baz'); + + $this->options->setNormalizer('foo', function (Options $options) { + $options->get('bam'); + }); + + $this->options->setNormalizer('bam', function (Options $options) { + $options->get('foo'); + }); + + $this->options->get('foo'); + } + + /** + * @expectedException Symfony\Component\OptionsResolver\Exception\OptionDefinitionException + */ + public function testFailForCyclicDependenciesBetweenNormalizerAndLazyOption() + { + $this->options->set('foo', function (Options $options) { + $options->get('bam'); + }); + $this->options->set('bam', 'baz'); + + $this->options->setNormalizer('bam', function (Options $options) { + $options->get('foo'); + }); + + $this->options->get('foo'); + } + + public function testAllInvokesEachLazyOptionOnlyOnce() + { + $test = $this; + $i = 1; + + $this->options->set('foo', function (Options $options) use ($test, &$i) { + $test->assertSame(1, $i); + ++$i; + + // Implicitly invoke lazy option for "bam" + $options->get('bam'); + }); + $this->options->set('bam', function (Options $options) use ($test, &$i) { + $test->assertSame(2, $i); + ++$i; + }); + + $this->options->all(); + } + + public function testAllInvokesEachNormalizerOnlyOnce() + { + $test = $this; + $i = 1; + + $this->options->set('foo', 'bar'); + $this->options->set('bam', 'baz'); + + $this->options->setNormalizer('foo', function (Options $options) use ($test, &$i) { + $test->assertSame(1, $i); + ++$i; + + // Implicitly invoke normalizer for "bam" + $options->get('bam'); + }); + $this->options->setNormalizer('bam', function (Options $options) use ($test, &$i) { + $test->assertSame(2, $i); + ++$i; + }); + + $this->options->all(); + } + public function testReplaceClearsAndSets() { $this->options->set('one', '1'); @@ -264,7 +430,7 @@ class OptionsTest extends \PHPUnit_Framework_TestCase $this->options->clear(); } - public function testOverloadCannotBeEvaluatedLazilyWithoutExpectedClousureParams() + public function testOverloadCannotBeEvaluatedLazilyWithoutExpectedClosureParams() { $this->options->set('foo', 'bar'); @@ -296,4 +462,11 @@ class OptionsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expectedResult, iterator_to_array($this->options, true)); } + + public function testHasWithNullValue() + { + $this->options->set('foo', null); + + $this->assertTrue($this->options->has('foo')); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php b/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php index 6df07a1..9cd7c78 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php @@ -180,7 +180,7 @@ class Process * the output in real-time while writing the standard input to the process. * It allows to have feedback from the independent process during execution. * If there is no callback passed, the wait() method can be called - * with true as a second parameter then the callback will get all data occured + * with true as a second parameter then the callback will get all data occurred * in (and since) the start call. * * @param Closure|string|array $callback A PHP callback to run whenever there is some @@ -525,7 +525,7 @@ class Process * * @param float $timeout The timeout in seconds * - * @return int The exitcode of the process + * @return integer The exitcode of the process * * @throws \RuntimeException if the process got signaled */ @@ -662,8 +662,8 @@ class Process /** * Builds up the callback used by wait(). * - * The callbacks adds all occured output to the specific buffer and calls - * the usercallback (if present) with the received output. + * The callbacks adds all occurred output to the specific buffer and calls + * the user callback (if present) with the received output. * * @param mixed $callback The user defined PHP callback * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessTest.php b/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessTest.php index 81f8171..c54f5d8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -146,7 +146,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase { $this->markTestSkipped('Can course php to hang'); - // Sleep dont work as it will allow the process to handle signals and close + // Sleep doesn't work as it will allow the process to handle signals and close // file handles from the other end. $process = new Process('php -r "while (true) {}"'); $process->start(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php index a8e0dcb..7213054 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php @@ -165,7 +165,7 @@ EOF; /** * Compiles a single Route to PHP code used to match it against the path info. * - * @param Route $routes A Route instance + * @param Route $route A Route instance * @param string $name The name of the Route * @param Boolean $supportsRedirections Whether redirections are supported by the base class * @param string|null $parentPrefix The prefix of the parent collection used to optimize the code diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php index b517907..c417d94 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -151,7 +151,7 @@ class UrlMatcher implements UrlMatcherInterface * * @param string $pathinfo The path * @param string $name The route name - * @param string $route The route + * @param Route $route The route * * @return array The first element represents the status, the second contains additional information */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCollection.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCollection.php index 000dad0..7a0e4c9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCollection.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCollection.php @@ -308,7 +308,7 @@ class RouteCollection implements \IteratorAggregate, \Countable { // It is ensured by the adders (->add and ->addCollection) that there can // only be one route per name in all connected collections. So we can stop - // interating recursively on the first hit. + // iterating recursively on the first hit. if (isset($this->routes[$name])) { unset($this->routes[$name]); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php index 53e86fa..2558b2d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -139,9 +139,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher } - // overriden + // overridden if (preg_match('#^/a/(?.*)$#s', $pathinfo, $matches)) { - $matches['_route'] = 'overriden'; + $matches['_route'] = 'overridden'; return $matches; } @@ -171,9 +171,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher return array_merge($this->mergeDefaults($matches, array ( 'who' => 'World!',)), array('_route' => 'helloWorld')); } - // overriden2 + // overridden2 if ($pathinfo === '/multi/new') { - return array('_route' => 'overriden2'); + return array('_route' => 'overridden2'); } // hey diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php index a3c105c..ad1476e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -147,9 +147,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec } - // overriden + // overridden if (preg_match('#^/a/(?.*)$#s', $pathinfo, $matches)) { - $matches['_route'] = 'overriden'; + $matches['_route'] = 'overridden'; return $matches; } @@ -179,9 +179,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec return array_merge($this->mergeDefaults($matches, array ( 'who' => 'World!',)), array('_route' => 'helloWorld')); } - // overriden2 + // overridden2 if ($pathinfo === '/multi/new') { - return array('_route' => 'overriden2'); + return array('_route' => 'overridden2'); } // hey diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php index 852de41..ab22ebd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php @@ -191,7 +191,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase /** * @expectedException Symfony\Component\Routing\Exception\InvalidParameterException */ - public function testGenerateForRouteWithInvalidManditoryParameter() + public function testGenerateForRouteWithInvalidMandatoryParameter() { $routes = $this->getRoutes('test', new Route('/testing/{foo}', array(), array('foo' => 'd+'))); $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), true); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php index e4e107c..8848720 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php @@ -17,6 +17,18 @@ use Symfony\Component\Routing\Matcher\ApacheUrlMatcher; class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase { + protected $server; + + protected function setUp() + { + $this->server = $_SERVER; + } + + protected function tearDown() + { + $_SERVER = $this->server; + } + /** * @dataProvider getMatchData */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index 69b3c07..ee11385 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -50,7 +50,7 @@ class PhpMatcherDumperTest extends \PHPUnit_Framework_TestCase $collection = new RouteCollection(); - $collection->add('overriden', new Route('/overriden')); + $collection->add('overridden', new Route('/overridden')); // defaults and requirements $collection->add('foo', new Route( @@ -116,25 +116,25 @@ class PhpMatcherDumperTest extends \PHPUnit_Framework_TestCase // prefixes $collection1 = new RouteCollection(); - $collection1->add('overriden', new Route('/overriden1')); + $collection1->add('overridden', new Route('/overridden1')); $collection1->add('foo1', new Route('/{foo}')); $collection1->add('bar1', new Route('/{bar}')); $collection2 = new RouteCollection(); $collection2->addCollection($collection1, '/b\'b'); - $collection2->add('overriden', new Route('/{var}', array(), array('var' => '.*'))); + $collection2->add('overridden', new Route('/{var}', array(), array('var' => '.*'))); $collection1 = new RouteCollection(); $collection1->add('foo2', new Route('/{foo1}')); $collection1->add('bar2', new Route('/{bar1}')); $collection2->addCollection($collection1, '/b\'b'); $collection->addCollection($collection2, '/a'); - // overriden through addCollection() and multiple sub-collections with no own prefix + // overridden through addCollection() and multiple sub-collections with no own prefix $collection1 = new RouteCollection(); - $collection1->add('overriden2', new Route('/old')); + $collection1->add('overridden2', new Route('/old')); $collection1->add('helloWorld', new Route('/hello/{who}', array('who' => 'World!'))); $collection2 = new RouteCollection(); $collection3 = new RouteCollection(); - $collection3->add('overriden2', new Route('/new')); + $collection3->add('overridden2', new Route('/new')); $collection3->add('hey', new Route('/hey/')); $collection1->addCollection($collection2); $collection2->addCollection($collection3); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php index 77d1f20..31069b2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php @@ -178,7 +178,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('_route' => 'foo', 'foo' => "\n"), $matcher->match('/'.urlencode("\n").'/bar'), 'linefeed character is matched'); } - public function testMatchOverridenRoute() + public function testMatchOverriddenRoute() { $collection = new RouteCollection(); $collection->add('foo', new Route('/foo')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php index 6a31cdc..792e65d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php @@ -37,7 +37,7 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase $collection->add('f o o', $route); } - public function testOverridenRoute() + public function testOverriddenRoute() { $collection = new RouteCollection(); $collection->add('foo', new Route('/foo')); @@ -46,7 +46,7 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/foo1', $collection->get('foo')->getPattern()); } - public function testDeepOverridenRoute() + public function testDeepOverriddenRoute() { $collection = new RouteCollection(); $collection->add('foo', new Route('/foo')); @@ -64,7 +64,7 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/foo2', $collection->get('foo')->getPattern()); } - public function testIteratorWithOverridenRoutes() + public function testIteratorWithOverriddenRoutes() { $collection = new RouteCollection(); $collection->add('foo', new Route('/foo')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md index 0093677..c570ac3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md @@ -21,7 +21,7 @@ CHANGELOG `UserSecurityIdentity::fromToken` now return correct identities for proxies objects (e.g. Doctrine proxies) * [BC BREAK] moved the default authentication success and failure handling to - seperate classes. The order of arguments in the constructor of the + separate classes. The order of arguments in the constructor of the `AbstractAuthenticationListener` has changed. - * [BC BREAK] moved the default logout sucess handling to a seperate class. The + * [BC BREAK] moved the default logout success handling to a separate class. The order of arguments in the constructor of `LogoutListener` has changed. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/User.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/User.php index 6076603..b378e1b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/User.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/User.php @@ -22,6 +22,7 @@ final class User implements AdvancedUserInterface { private $username; private $password; + private $enabled; private $accountNonExpired; private $credentialsNonExpired; private $accountNonLocked; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php index 66d6bda..dc7cbe5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php @@ -102,7 +102,7 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle return $targetUrl; } - if ($this->options['use_referer'] && ($targetUrl = $request->headers->get('Referer')) && $targetUrl !== $request->getUriForPath($this->options['login_path'])) { + if ($this->options['use_referer'] && ($targetUrl = $request->headers->get('Referer')) && $targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) { return $targetUrl; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php index f242501..2225d92 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php @@ -21,17 +21,33 @@ class InteractiveLoginEvent extends Event private $authenticationToken; + /** + * Constructor. + * + * @param Request $request A Request instance + * @param TokenInterface $authenticationToken A TokenInterface instance + */ public function __construct(Request $request, TokenInterface $authenticationToken) { $this->request = $request; $this->authenticationToken = $authenticationToken; } + /** + * Gets the request. + * + * @return Request A Request instance + */ public function getRequest() { return $this->request; } + /** + * Gets the authentication token. + * + * @return TokenInterface A TokenInterface instance + */ public function getAuthenticationToken() { return $this->authenticationToken; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Dbal/MutableAclProviderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Dbal/MutableAclProviderTest.php index e264b6d..837daad 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Dbal/MutableAclProviderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Dbal/MutableAclProviderTest.php @@ -267,7 +267,7 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase $provider->updateAcl($acl); } - public function testUpdateAclThrowsExceptionOnConcurrentModifcationOfSharedProperties() + public function testUpdateAclThrowsExceptionOnConcurrentModificationOfSharedProperties() { $provider = $this->getProvider(); $acl1 = $provider->createAcl(new ObjectIdentity(1, 'Foo')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/AclTest.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/AclTest.php index b6f3d79..4b67e62 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/AclTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/AclTest.php @@ -433,7 +433,7 @@ class AclTest extends \PHPUnit_Framework_TestCase * @expectedException \InvalidArgumentException * @dataProvider getUpdateFieldAuditingTests */ - public function testUpdateFieldAuditingthrowsExceptionOnInvalidField($type) + public function testUpdateFieldAuditingThrowsExceptionOnInvalidField($type) { $acl = $this->getAcl(); $acl->{'update'.$type.'Auditing'}(0, 'foo', true, true); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/PermissionGrantingStrategyTest.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/PermissionGrantingStrategyTest.php index 67c9f3f..f34bc3e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/PermissionGrantingStrategyTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/PermissionGrantingStrategyTest.php @@ -31,7 +31,7 @@ class PermissionGrantingStrategyTest extends \PHPUnit_Framework_TestCase $this->assertFalse($strategy->isGranted($acl, array(1), array($sid))); } - public function testIsGrantedFallsbackToClassAcesIfNoApplicableObjectAceWasFound() + public function testIsGrantedFallsBackToClassAcesIfNoApplicableObjectAceWasFound() { $strategy = new PermissionGrantingStrategy(); $acl = $this->getAcl($strategy); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/UserSecurityIdentityTest.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/UserSecurityIdentityTest.php index 9650803..1d6a3c5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/UserSecurityIdentityTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/UserSecurityIdentityTest.php @@ -25,7 +25,7 @@ class UserSecurityIdentityTest extends \PHPUnit_Framework_TestCase } // Test that constructor never changes the type, even for proxies - public function testContructorWithProxy() + public function testConstructorWithProxy() { $id = new UserSecurityIdentity('foo', 'Acme\DemoBundle\Proxy\__CG__\Symfony\Component\Security\Tests\Acl\Domain\Foo'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/SerializerAwareNormalizer.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/SerializerAwareNormalizer.php index 97e5dfb..49916be 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/SerializerAwareNormalizer.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/SerializerAwareNormalizer.php @@ -21,6 +21,9 @@ use Symfony\Component\Serializer\SerializerAwareInterface; */ abstract class SerializerAwareNormalizer implements SerializerAwareInterface { + /** + * @var SerializerInterface + */ protected $serializer; /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php index f3f1fb8..29177ff 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php @@ -24,7 +24,7 @@ foo', 'foo;foo' => 'bar')); $tempDir = sys_get_temp_dir(); $dumper = new CsvFileDumper(); - $dumperString = $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/valid.csv'), file_get_contents($tempDir.'/messages.en.csv')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php index ce1da5a..d187ef1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php @@ -27,7 +27,7 @@ class IcuResFileDumperTest extends \PHPUnit_Framework_TestCase $tempDir = sys_get_temp_dir(); $dumper = new IcuResFileDumper(); - $dumperString = $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resourcebundle/res/en.res'), file_get_contents($tempDir.'/messages/en.res')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php index be5895a..2a2cefd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php @@ -23,7 +23,7 @@ class IniFileDumperTest extends \PHPUnit_Framework_TestCase $tempDir = sys_get_temp_dir(); $dumper = new IniFileDumper(); - $dumperString = $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.ini'), file_get_contents($tempDir.'/messages.en.ini')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php index 5b35d81..439a25c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php @@ -23,7 +23,7 @@ class MoFileDumperTest extends \PHPUnit_Framework_TestCase $tempDir = sys_get_temp_dir(); $dumper = new MoFileDumper(); - $dumperString = $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.mo'), file_get_contents($tempDir.'/messages.en.mo')); unlink($tempDir.'/messages.en.mo'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php index ef37d18..18be5a0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php @@ -23,7 +23,7 @@ class PhpFileDumperTest extends \PHPUnit_Framework_TestCase $tempDir = sys_get_temp_dir(); $dumper = new PhpFileDumper(); - $dumperString = $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.php'), file_get_contents($tempDir.'/messages.en.php')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php index 9c434f9..0296d6b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php @@ -23,7 +23,7 @@ class PoFileDumperTest extends \PHPUnit_Framework_TestCase $tempDir = sys_get_temp_dir(); $dumper = new PoFileDumper(); - $dumperString = $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.po'), file_get_contents($tempDir.'/messages.en.po')); unlink($tempDir.'/messages.en.po'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php index 8e63ee9..d7d8fb7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php @@ -23,7 +23,7 @@ class QtFileDumperTest extends \PHPUnit_Framework_TestCase $tempDir = sys_get_temp_dir(); $dumper = new QtFileDumper(); - $dumperString = $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.ts'), file_get_contents($tempDir.'/resources.en.ts')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php index 5514221..bef3135 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php @@ -23,7 +23,7 @@ class XliffFileDumperTest extends \PHPUnit_Framework_TestCase $tempDir = sys_get_temp_dir(); $dumper = new XliffFileDumper(); - $dumperString = $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources-clean.xlf'), file_get_contents($tempDir.'/messages.en.xlf')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php index e96681c..e4e68e0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php @@ -30,7 +30,7 @@ class YamlFileDumperTest extends \PHPUnit_Framework_TestCase $tempDir = sys_get_temp_dir(); $dumper = new YamlFileDumper(); - $dumperString = $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.yml'), file_get_contents($tempDir.'/messages.en.yml')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php index 4832ab7..26f9e2f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php @@ -22,7 +22,7 @@ use Symfony\Component\Translation\PluralizationRules; * * As mentioned by chx http://drupal.org/node/1273968 we can cover all by testing number from 0 to 199 * - * The goal to cover all languagues is to far fetched so this test case is smaller. + * The goal to cover all languages is to far fetched so this test case is smaller. * * @author Clemens Tolboom clemens@build2be.nl */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Writer/TranslationWriter.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Writer/TranslationWriter.php index 4d68ce5..6e935e0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Writer/TranslationWriter.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Writer/TranslationWriter.php @@ -53,7 +53,7 @@ class TranslationWriter * Writes translation from the catalogue according to the selected format. * * @param MessageCatalogue $catalogue The message catalogue to dump - * @param type $format The format to use to dump the messages + * @param string $format The format to use to dump the messages * @param array $options Options that are passed to the dumper */ public function writeTranslations(MessageCatalogue $catalogue, $format, $options = array()) diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/Validator/CHANGELOG.md index dbc3e0b..e49881a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/CHANGELOG.md @@ -23,6 +23,6 @@ CHANGELOG which enables the BC behavior. * added Count constraint * added Length constraint - * deprecated the Size constraint and renamed it to Range + * added Range constraint * deprecated the Min and Max constraints * deprecated the MinLength and MaxLength constraints diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Size.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Size.php deleted file mode 100644 index 625f86e..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Size.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * - * @api - * - * @deprecated Deprecated since version 2.1, to be removed in 2.3. - */ -class Size extends Range -{ - /** - * {@inheritDoc} - */ - public function validatedBy() - { - return get_parent_class($this).'Validator'; - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/SizeValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/SizeValidator.php deleted file mode 100644 index 605e74b..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/SizeValidator.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; - -/** - * @author Bernhard Schussek - * - * @api - * - * @deprecated Deprecated since version 2.1, to be removed in 2.3. - */ -class SizeValidator extends RangeValidator -{ -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php index dbcef69..5a343b4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php @@ -108,7 +108,7 @@ class LengthValidatorTest extends \PHPUnit_Framework_TestCase public function testValidValuesMin($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $this->context->expects($this->never()) @@ -124,7 +124,7 @@ class LengthValidatorTest extends \PHPUnit_Framework_TestCase public function testValidValuesMax($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $this->context->expects($this->never()) @@ -140,7 +140,7 @@ class LengthValidatorTest extends \PHPUnit_Framework_TestCase public function testValidValuesExact($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $this->context->expects($this->never()) @@ -156,7 +156,7 @@ class LengthValidatorTest extends \PHPUnit_Framework_TestCase public function testInvalidValuesMin($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $constraint = new Length(array( @@ -180,7 +180,7 @@ class LengthValidatorTest extends \PHPUnit_Framework_TestCase public function testInvalidValuesMax($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $constraint = new Length(array( @@ -204,7 +204,7 @@ class LengthValidatorTest extends \PHPUnit_Framework_TestCase public function testInvalidValuesExact($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $constraint = new Length(array( diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxLengthValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxLengthValidatorTest.php index 12091b7..4db9103 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxLengthValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxLengthValidatorTest.php @@ -62,7 +62,7 @@ class MaxLengthValidatorTest extends \PHPUnit_Framework_TestCase public function testValidValues($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $this->context->expects($this->never()) @@ -88,7 +88,7 @@ class MaxLengthValidatorTest extends \PHPUnit_Framework_TestCase public function testInvalidValues($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $constraint = new MaxLength(array( diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinLengthValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinLengthValidatorTest.php index e3a1d01..08d0a81 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinLengthValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinLengthValidatorTest.php @@ -62,7 +62,7 @@ class MinLengthValidatorTest extends \PHPUnit_Framework_TestCase public function testValidValues($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $this->context->expects($this->never()) @@ -88,7 +88,7 @@ class MinLengthValidatorTest extends \PHPUnit_Framework_TestCase public function testInvalidValues($value, $mbOnly = false) { if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); + $this->markTestSkipped('mb_strlen does not exist'); } $constraint = new MinLength(array( diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test index 357b352..2bd3d4c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test @@ -5,10 +5,12 @@ {{ items|merge({'bar': 'foo'})|keys|join }} {{ {'bar': 'foo'}|merge(items)|join }} {{ {'bar': 'foo'}|merge(items)|keys|join }} +{{ numerics|merge([4, 5, 6])|join }} --DATA-- -return array('items' => array('foo' => 'bar')) +return array('items' => array('foo' => 'bar'), 'numerics' => array(1, 2, 3)) --EXPECT-- barfoo foobar foobar barfoo +123456