Commit Graph

8345 Commits

Author SHA1 Message Date
Fabien Potencier
c614be74c8 merged branch bschussek/issue2308 (PR #3320)
Commits
-------

0a4519d [Form] Fixed duplicate errors on forms with "error_bubbling"=false

Discussion
----------

[Form] Fixed duplicate errors on forms with "error_bubbling"=false

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2308
Todo: -

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue2308)
2012-02-10 12:59:38 +01:00
Fabien Potencier
feb0dfd55e merged branch bschussek/issue2553 (PR #3319)
Commits
-------

6a45a41 [Form] Fixed Form::bindRequest() when used on a form without children

Discussion
----------

[Form] Fixed Form::bindRequest() when used on a form without children

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2553
Todo: -

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue2553)
2012-02-10 12:55:15 +01:00
Fabien Potencier
6d793e72bf merged branch bschussek/issue2226 (PR #3321)
Commits
-------

2521962 [Form] Added constant Guess::VERY_HIGH_CONFIDENCE

Discussion
----------

[Form] Added constant Guess::VERY_HIGH_CONFIDENCE

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2226
Todo: -

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue2226)
2012-02-10 12:52:45 +01:00
Bernhard Schussek
2521962260 [Form] Added constant Guess::VERY_HIGH_CONFIDENCE 2012-02-10 12:01:35 +01:00
Bernhard Schussek
0a4519d103 [Form] Fixed duplicate errors on forms with "error_bubbling"=false 2012-02-10 11:41:19 +01:00
Bernhard Schussek
6a45a415a1 [Form] Fixed Form::bindRequest() when used on a form without children 2012-02-10 10:36:16 +01:00
William DURAND
3910735784 [Propel] Avoid to duplicate objects 2012-02-09 22:08:39 +01:00
Bernhard Schussek
da2447e118 [Form] Fixed MergeCollectionListener when used with a custom property path 2012-02-09 18:29:42 +01:00
Bernhard Schussek
b56502f023 [Form] Added getParent() to PropertyPath 2012-02-09 18:11:16 +01:00
Bernhard Schussek
7e5104e09b [Form] Fixed MergeCollectionListener for the case that the form's data is updated by the data mapper (as happening in CollectionType) 2012-02-09 18:11:10 +01:00
Bernhard Schussek
22c8f8087c [Form] Fixed issues mentioned in the PR comments 2012-02-09 17:13:33 +01:00
Fabien Potencier
11e3516583 merged branch blogsh/dynamic_group_sequence (PR #3199)
Commits
-------

411a0cc [Validator] Added GroupSequenceProvider to changelog
815c769 [Validator] Renamed getValidationGroups to getGroupSequence
d84a2e4 [Validator] Updated test expectations
9f2310b [Validator] Fixed typos, renamed hasGroupSequenceProvider
e0d2828 [Validator] GroupSequenceProvider tests improved, configuration changed
c3b04a3 [Validator] Changed GroupSequenceProvider implementation
6c4455f [Validator] Added GroupSequenceProvider

Discussion
----------

[Validator] Added GroupSequenceProvider

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: ![](https://secure.travis-ci.org/blogsh/symfony.png?branch=dynamic_group_sequence)

As discussed in #3114 I implemented the "GroupSequenceProvider" pattern for the validator component. It allows the user to select certain validation groups based on the current state of an object. Here is an example:

    /**
     * @Assert\GroupSequenceProvider("UserGroupSequnceProvider")
     */
    class User
    {
        /**
         * @Assert\NotBlank(groups={"Premium"})
         */
        public function getAddress();

        public function hasPremiumSubscription();
    }

    class UserGroupSequenceProvider implements GroupSequenceProviderInterface
    {
        public function getValidationGroups($user)
        {
            if ($user->hasPremiumSubscription()) {
                return array('User', 'Premium');
            } else {
                return array('User');
            }
        }
    }

With this patch there are two mechanisms to define the group sequence now. Either you can use @GroupSequence to define a static order of validation groups or you can use @GroupSequenceProvider to create dynamic validation group arrays.
The ClassMetadata therefore has methods now which implement quite similar things. The question is whether it would make sense to interpret the static group sequence as a special case and create something like a DefaultGroupSequenceProvider or StaticGroupSequenceProvider which is assigned by default. This would cause a BC break inside the validator component.

---------------------------------------------------------------------------

by bschussek at 2012-01-28T13:39:54Z

I like the implementation, but I think we should differ a little bit from Java here.

1. `GroupSequenceProviderInterface` should be implemented by the domain classes themselves (`User`), not by a separate class.
2. As such, the parameter `$object` from `getValidationGroups($object)` can be removed
3. `ClassMetadata::setGroupSequenceProvider()` should accept a boolean to activate/deactivate this functionality. Also the check for the interface (does the underlying class implement it?) should be done here

Apart from that, special cases need to be treated:

* A definition of a group sequence and a group sequence provider in the same `ClassMetadata` should not be allowed. Either of them must not be set.
* Metadata loaders must take care of settings made by parent classes. If `Animal` is extended by `Dog`, `Animal` defines a group sequence (or group sequence provider) and `Dog` a group sequence provider (or group sequence), only the setting of `Dog` should apply

---------------------------------------------------------------------------

by blogsh at 2012-01-28T21:25:37Z

Changes of the latest commit:

- GroupSequenceProviderInterface has to be implemented by the domain class
- The annotation/configuration options let the user define whether the provider is activated or not (is this neccessary at all?)
- An error is thrown if the user wants to use static group sequences and the provider simultaneously

At the moment neither the static group sequence nor the provider is inherited from parent classes or interfaces. I don't know if it would make sense to enable this feature. There could be problems if a user wants to define a static group sequence in the parent class and a sequence provider in the child class.

---------------------------------------------------------------------------

by bschussek at 2012-01-30T13:07:04Z

> There could be problems if a user wants to define a static group sequence in the parent class and a sequence provider in the child class.

In this case, the setting in the child class should override the setting of the parent class.

But we can leave this open for now. As it seems, [this issue is unresolved in Hibernate as well](https://hibernate.onjira.com/browse/HV-467).

---------------------------------------------------------------------------

by blogsh at 2012-01-30T22:54:41Z

Okay, finally I managed to upload the latest commit. If you got a bunch of notifications or so I'm sorry, but I had to revert some accidental changes in the commit :(

I've rewritten the tests and have removed the "active" setting in the XML configuration.

---------------------------------------------------------------------------

by blogsh at 2012-02-02T15:24:01Z

Okay, typos are fixed now and `hasGroupSequenceProvider` has been renamed to `isGroupSequenceProvider`. I also had to adjust some tests after the rebase with master.

---------------------------------------------------------------------------

by bschussek at 2012-02-03T09:25:19Z

Looks good.

@fabpot 👍

---------------------------------------------------------------------------

by fabpot at 2012-02-03T09:46:52Z

Can you add a note in the CHANGELOG before I merge? Thanks.

---------------------------------------------------------------------------

by blogsh at 2012-02-09T12:31:27Z

@fabpot done
2012-02-09 13:39:47 +01:00
William DURAND
d69144c614 [Propel] Refactored the CollectionToArray transformer 2012-02-09 10:59:13 +01:00
Fabien Potencier
7eb22a7711 [MonologBundle] moved bundle to its own repository 2012-02-09 10:22:21 +01:00
Fabien Potencier
c0c75c8d15 removed Swiftmailer from vendors.php 2012-02-09 10:20:48 +01:00
Fabien Potencier
0e17e8bfff merged branch henrikbjorn/swiftmailer-composer (PR #3304)
Commits
-------

f143822 Removed invalid dependencies and replaces in composer.json

Discussion
----------

Removed invalid dependencies and replaces in composer.json
2012-02-09 10:19:06 +01:00
Fabien Potencier
a53cd6954a removed Swiftmailer from composer.json 2012-02-09 10:13:28 +01:00
Henrik Bjørnskov
f143822d52 Removed invalid dependencies and replaces in composer.json 2012-02-09 10:13:03 +01:00
Fabien Potencier
e69a30b2a5 [SwiftmailerBundle] moved the bundle to its own repository 2012-02-09 09:51:46 +01:00
Fabien Potencier
1e3028d0d7 merged branch benji07/patch-1 (PR #3289)
Commits
-------

a38cfa3 [Serializer] Fix typo

Discussion
----------

[Serializer] Fix typo in comments
2012-02-09 07:26:49 +01:00
Fabien Potencier
4c4a1d6d8a merged branch jmikola/cc-optional-warmers (PR #3302)
Commits
-------

42c9892 [FrameworkBundle] Allow cache:clear/warmup to skip optional warmers

Discussion
----------

[FrameworkBundle] Allow cache:clear/warmup to skip optional warmers

> Bug fix: no
> Feature addition: yes
> Backwards compatibility break: yes
> Symfony2 tests pass: [yes](http://travis-ci.org/#!/jmikola/symfony/builds/647861)

Exercise.com has been using this for a while for our local environments. Skipping the optional cache warmers (namely Assetic) can save quite a bit of time.
2012-02-09 07:08:52 +01:00
Jeremy Mikola
42c98921a2 [FrameworkBundle] Allow cache:clear/warmup to skip optional warmers 2012-02-08 20:16:02 -05:00
William DURAND
1706671159 [Propel] Fixed naming to reflect Doctrine bridge 2012-02-09 00:57:25 +01:00
William DURAND
1f277dfad9 [Propel] Removed useless ModelToIdTransformer 2012-02-09 00:54:49 +01:00
Fabien Potencier
11f83a6481 merged branch umpirsky/serbian-translation-latin (PR #3297)
Commits
-------

fd15529 Added Serbian Latin translation for validatoor messages.

Discussion
----------

Added Serbian Latin translation for validatoor messages.

Files named as specified by stof https://github.com/symfony/symfony/pull/3167#issuecomment-3598423
2012-02-08 07:58:07 +01:00
Sasa Stamenkovic
fd15529ea6 Added Serbian Latin translation for validatoor messages. 2012-02-07 21:49:41 +01:00
Bernhard Schussek
3b1b57030b [Form] Fixed: The "date", "time" and "datetime" types can be initialized with \DateTime objects 2012-02-07 11:10:02 +01:00
Bernhard Schussek
88ef52d272 [Form] Improved FormType::getDefaultOptions() to see default options defined in parent types
In turn, FormType::getParent() does not see default options anymore.
2012-02-07 10:51:21 +01:00
Bernhard Schussek
b9facfc5ae [Form] Removed undefined variables in exception constructor 2012-02-07 10:47:01 +01:00
Benjamin Lévêque
a38cfa3763 [Serializer] Fix typo 2012-02-07 10:25:10 +01:00
Victor Berchet
ac59db7eef cleanup 2012-02-06 20:42:20 +01:00
Victor Berchet
64ea95dea1 [WebProfilerBundle] Add redirection info to the router panel
Conflicts:

	src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php
	src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml
	src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
2012-02-06 19:26:06 +01:00
Victor Berchet
826bd230a1 [FrameworkBundle] fix phpDoc of ControllerResolver::createController() 2012-02-06 19:09:38 +01:00
Victor Berchet
e3cf37fe84 [HttpFoundation] RedirectResponse: add the ability to retrieve the target URL, add unit tests 2012-02-06 19:09:24 +01:00
Victor Berchet
50c85aef24 [WebProfiler] Add info to the router panel 2012-02-06 19:08:49 +01:00
Victor Berchet
0d4d7e0b9b [WebProfilerBundle] Make the toolbar use the common JS 2012-02-06 18:41:13 +01:00
Victor Berchet
a440279e5f [WebProfilerBundle] Adds panel pages
Conflicts:

	src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
2012-02-06 18:40:46 +01:00
Victor Berchet
762d90d859 [Profiler] Buid a common infrastructure 2012-02-06 18:39:12 +01:00
Victor Berchet
3896fdd6ef [WebProfilerBundle] Some cleanup 2012-02-06 18:27:38 +01:00
Fabien Potencier
5676a91b8d updated CHANGELOG for 2.1 2012-02-06 17:45:32 +01:00
Fabien Potencier
8c11e9baa7 merged branch thesalla/mapfiledumper (PR #2471)
Commits
-------

ba3b321 [ClassLoader] Added a class map file generator utility

Discussion
----------

[ClassLoader] Added a class map file generator utility

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2407

---------------------------------------------------------------------------

by lsmith77 at 2011-11-30T19:33:52Z

@thesalla do you have time/interest to finish this up?

---------------------------------------------------------------------------

by thesalla at 2011-12-01T09:55:50Z

sure (will attempt at least), but no sooner than tomorrow

---------------------------------------------------------------------------

by stof at 2011-12-12T20:41:41Z

@thesalla @fabpot what is the state of this PR ?

---------------------------------------------------------------------------

by thesalla at 2011-12-17T19:36:58Z

If you don't have any other suggestions or ideas, I'd consider it finished.

---------------------------------------------------------------------------

by lsmith77 at 2012-01-24T09:27:12Z

ping

---------------------------------------------------------------------------

by fabpot at 2012-02-02T08:21:38Z

@thesalla: Can you rename the ClassMapDumper class to ClassMapGenerator and then squash your commit before the merge? Thanks.

---------------------------------------------------------------------------

by thesalla at 2012-02-04T12:55:48Z

@fabpot done.
2012-02-06 17:45:10 +01:00
Fabien Potencier
aa1676c7b5 merged branch henrikbjorn/doctrine-unique-validator (PR #3275)
Commits
-------

928e352 Change the array access used in UniqueEntityValidator

Discussion
----------

[DoctrineBridge] Change the array access used in UniqueEntityValidator

MongoDB ODM Cursor does not implement ArrayAccess and therefor using
`$result[0]` will fail. `reset()` rewinds the array and returns the
first element value.

DoctrineMongoDBBundle#77

/cc @beberlei

---------------------------------------------------------------------------

by henrikbjorn at 2012-02-06T08:09:25Z

Made a mistake, the findBy call would still return a cursor. Changed the findBy to findOneBy we only want one result anyway.

---------------------------------------------------------------------------

by stof at 2012-02-06T08:11:26Z

findOneBy is wrong: you will not detect duplicate anymore if you return a single element

---------------------------------------------------------------------------

by henrikbjorn at 2012-02-06T08:28:03Z

@stof before it was only the first result that was used anyway so if it had found 3 results it would only have used the first one. Performance is apparently the biggest issue with findOneBy so this have been reverted.

---------------------------------------------------------------------------

by stof at 2012-02-06T08:31:17Z

@henrikbjorn no, we use other results too: if ``count()`` is not 1, the validation fails

---------------------------------------------------------------------------

by stof at 2012-02-06T08:36:06Z

Btw, running the testsuite would have tell you there is an issue when using findOneBy as it was breaking a test :)

---------------------------------------------------------------------------

by bschussek at 2012-02-06T10:45:44Z

Why doesn't this validator use a SELECT COUNT anyway?

---------------------------------------------------------------------------

by stof at 2012-02-06T10:57:00Z

@bschussek because we need to check if an existing value is for the same object or another one. Otherwise, the valdiation would fail as soon as you are editing an existing object without changing the unique value

---------------------------------------------------------------------------

by henrikbjorn at 2012-02-06T11:03:40Z

@stof @bschussek other changes that should be done? Else it should be ready to be merged ?

---------------------------------------------------------------------------

by henrikbjorn at 2012-02-06T13:00:57Z

@stof done an rebased.

---------------------------------------------------------------------------

by bschussek at 2012-02-06T13:04:44Z

👍 /cc @fabpot
2012-02-06 14:06:46 +01:00
Henrik Bjørnskov
928e352d09 Change the array access used in UniqueEntityValidator
convert iterator to array if it isnt already (mongodb)

More specific if

Dont do iterator_to_array if object implements \ArrayAccess

CS fix
2012-02-06 14:00:20 +01:00
Fabien Potencier
9855886dc5 merged branch grizlik/master (PR #3261)
Commits
-------

b65a997 [Form] Added test ChoiceList::testGetChoicesForValuesCorrectOrderingOfResult for correct ordering check
a60daff [Form] Fixed incorrect sorting in ChoiceList::getChoicesForValues

Discussion
----------

[Form] Fixed incorrect sorting in ChoiceList::getChoicesForValues

ChoiceList::getChoicesForValues return collection with sorting, that not corresponding to the sorting for input keys

---------------------------------------------------------------------------

by bschussek at 2012-02-03T21:40:49Z

Can you adapt the test cases to fail for this case please? (probably by use of assertSame instead of assertEquals in one of the existing tests)

---------------------------------------------------------------------------

by grizlik at 2012-02-04T08:41:44Z

I need to create a new test or modify an existing one?

---------------------------------------------------------------------------

by bschussek at 2012-02-04T09:58:04Z

Something like this in ChoiceListTest:

    public function testGetChoicesForValuesReverseOrderedValues()
    {
        $values = array('2', '1');
        $this->assertSame(array($this->obj3, $this->obj2), $this->list->getChoicesForValues($values));
    }
2012-02-06 09:56:24 +01:00
Fabien Potencier
c75ca12140 merged branch bschussek/issue3269 (PR #3270)
Commits
-------

78c1451 [Validator] Throwing exception in ConstraintValidator::setMessage() if initialize() wasn't called

Discussion
----------

[Validator] Throwing exception in ConstraintValidator::setMessage() if initialize() wasn't called

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue3269)

---------------------------------------------------------------------------

by Maks3w at 2012-02-05T09:52:21Z

One problem was that. Now I initialized the unit test with a execution
context mockup and works good.

Another problem I found is in the rules for upgrade from 2.0 to
2.1:

In v2.0: with setMessages() only one argument is mandatory ($message)
In v2.1: With the new way, addViolation(), then you need 2 arguments.
But, in v2.0 with the new way, addViolation, required 3 arguments.

So for preserve forward and backward compatibility, you need pass 3
arguments to addViolation()  I think that it is helpfull and could be written in the
doc.

At the last one ¿What is the purpose of the third argument? ¿Can I pass
any object as invalid value?

Thanks

---------------------------------------------------------------------------

by bschussek at 2012-02-05T10:45:16Z

The last argument should always be the validated value that caused the constraint to fail.
2012-02-06 09:53:04 +01:00
Fabien Potencier
1bef14a02a [Process] fixed usage of constants in closure 2012-02-06 07:00:39 +01:00
Fabien Potencier
7581c3b221 merged branch willdurand/fix-propel-bridge (PR #3274)
Commits
-------

80682ba Fixed CS
007de8c [Tests] [Propel] Added some tests for the ModelChoiceList class
8257efd [Propel] Refactored the whole ModelChoiceList

Discussion
----------

Fix propel bridge

Ok, so I rewrote the `ModelChoiceList` based on the `EntityChoiceList`, and I provided the same test suite.
Sorry for the last PR, it was a fix to avoid fatal..

Cheers,
William
2012-02-06 06:57:03 +01:00
William DURAND
80682ba3c9 Fixed CS 2012-02-06 00:17:29 +01:00
William DURAND
007de8c265 [Tests] [Propel] Added some tests for the ModelChoiceList class 2012-02-05 23:08:07 +01:00
William DURAND
8257efd38f [Propel] Refactored the whole ModelChoiceList 2012-02-05 23:08:06 +01:00