Commit Graph

156 Commits

Author SHA1 Message Date
Fabien Potencier 4a0057fd56 merged branch kbond/hinclude (PR #3259)
Commits
-------

cea2c7e removed unneeded local variable
924f378 updated changelog
72d5805 changed route name
41cc0d6 [FrameworkBundle] added support for HInclude

Discussion
----------

[FrameworkBundle] added support for HInclude

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: discuss
Example: https://github.com/kbond/symfony-standard/tree/hinclude

**Reopened this as I broke #2903**

References:

 - http://groups.google.com/group/symfony-devs/browse_thread/thread/b74e587d6f2f87b0
 - http://groups.google.com/group/symfony-devs/browse_thread/thread/8776a9833d4a5f79
 - #2903
 - #2865

[![Build Status](https://secure.travis-ci.org/kbond/symfony.png?branch=hinclude)](http://travis-ci.org/kbond/symfony)

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

by kbond at 2012-02-11T20:27:22Z

unless there is anything else I think this is ready, want me to squash again?

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

by fabpot at 2012-02-11T21:07:33Z

@kbond: Can you add some information about the changes in the CHANGELOG?

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

by Tobion at 2012-02-11T21:33:32Z

Do I see it correctly that we cannot set a default template on a per hinclude tag basis? But only global?
That's not really usefull when javascript is disabled because it should resemble the content to be included as an alternative.

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

by stof at 2012-02-11T21:42:15Z

@Tobion currently it is not possible. But changing the content on a tag basis may require changing the way the render tag look like (as there is no content in the tag currently) so this needs further discussion and @fabpot said he wants to merge a first implementation without it. See the discussion above.
2012-02-15 00:06:30 +01:00
Fabien Potencier 803fba887a merged branch vicb/routing-ok (PR #3313)
Commits
-------

9d6eb82 [Routing] Fix a bug in the TraceableUrlMatcher
9fc8d28 [FrameworkBundle] Fix a bug in the RedirectableUrlMatcher
4fcf9ef [Routing] Small optimization in the UrlMatcher
abc2141 [Routing] Added a missing property declaration
d86e1eb [Routing] Remove a weird dependency

Discussion
----------

[Routing] Remove a dependency on a derived class, fixes, optim

Subset of #3296 which should be acceptable.

Travis is happy.

The side effect of removing the dependency is that the `UrlMatcher` does not throw an exception any more when the scheme does not match the required scheme. I think it is better because:

* it removes a dependency on a derived class,
* it was an undocumented "feature",
* other thrown excs are component specific while this one was raw SPL.

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

by vicb at 2012-02-09T14:43:02Z

let me know what should go in 2.0 as well.
2012-02-15 00:01:15 +01:00
Drak 388a9c2861 [HttpFoundation] Make SessionHandlerInterface compatible with PHP 5.4's SessionHandlerInterface 2012-02-13 11:35:29 +05:45
Kevin Bond c02c959aae updated changelog with config:dump-reference command 2012-02-12 10:19:38 -05:00
Fabien Potencier e43e14987f updated CHANGELOG for 2.1 2012-02-12 13:29:30 +01:00
Fabien Potencier 7e4f4dcdf9 merged branch bschussek/issue3022 (PR #3322)
Commits
-------

cde34fd [Form] Throwing an AlreadyBoundException in `add`, `remove`, `setParent`, `bind` and `setData` if called on a bound form

Discussion
----------

[Form] Throwing an AlreadyBoundException in `add`, `remove`, `setParent`, `bind` and `setData` if called on a bound form

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

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

The above mentioned methods now throw an exception because when invoked on a bound form they might cause strange side effects. You should rely on event listeners instead of modifying bound forms.

See also #3022
2012-02-12 00:48:39 +01:00
Kevin Bond 924f378242 updated changelog 2012-02-11 16:20:40 -05:00
Fabien Potencier cb6fdb1f5e [HttpFoundation] removed Session::close() 2012-02-11 15:53:54 +01:00
Fabien Potencier 8a01dd5cff renamed getFlashes() to getFlashBag() to avoid clashes 2012-02-11 13:18:56 +01:00
Fabien Potencier 282d3ae1d8 updated CHANGELOG for 2.1 2012-02-11 12:54:27 +01:00
Fabien Potencier 146a502a0e [FrameworkBundle] added some service aliases to avoid some BC breaks 2012-02-11 12:36:09 +01:00
Fabien Potencier 74ccf7062a reverted 5b7ef11650 (Simplify session
storage class names now we have a separate namespace for sessions)
2012-02-11 12:04:50 +01:00
Fabien Potencier 7878a0a11a [HttpFoundation] renamed pop() to all() and getAll() to all() 2012-02-11 11:53:00 +01:00
Drak 0d2745f750 [HttpFoundation] Remove constants from FlashBagInterface
As requested by fabpot.
Corrected a few mistakes in the documentation.
2012-02-11 11:24:43 +05:45
Drak 5b7ef11650 [HttpFoundation] Simplify session storage class names now we have a separate namespace for sessions. 2012-02-11 11:24:35 +05:45
Drak 27530cbb1e [HttpFoundation] Moved session related classes to own sub-namespace. 2012-02-11 11:24:31 +05:45
Drak 468391525a [HttpFoundation] Free bags from session storage and move classes to their own namespaces. 2012-02-11 11:24:26 +05:45
Drak 398acc9e9f [HttpFoundation] Reworked flashes to maintain same behaviour as in Symfony 2.0 2012-02-11 11:24:15 +05:45
Drak 9dd4dbed6d Documentation, changelogs and coding standards. 2012-02-11 11:24:07 +05:45
Bernhard Schussek cde34fd8ce [Form] Throwing an AlreadyBoundException in `add`, `remove`, `setParent`, `bind` and `setData` if called on a bound form 2012-02-10 15:40:01 +01:00
Fabien Potencier 5ca472bd45 merged branch vicb/profiler/routing (PR #3283)
Commits
-------

ac59db7 cleanup
64ea95d [WebProfilerBundle] Add redirection info to the router panel
826bd23 [FrameworkBundle] fix phpDoc of ControllerResolver::createController()
e3cf37f [HttpFoundation] RedirectResponse: add the ability to retrieve the target URL, add unit tests
50c85ae [WebProfiler] Add info to the router panel

Discussion
----------

[WIP][Profiler] Routing

former #3206 part 3 (depends on part 1 - #3280)

The goal of this PR is to fix #3264 by adding redirection infos on the router panel.

Done:

* Add info on the target url / route

To do:

* Display an accurate URL matching process (when using the RedirectableUrlMatcher)
2012-02-10 13:31:26 +01:00
Fabien Potencier be2e67c1ab merged branch bschussek/issue3288 (PR #3290)
Commits
-------

22c8f80 [Form] Fixed issues mentioned in the PR comments
3b1b570 [Form] Fixed: The "date", "time" and "datetime" types can be initialized with \DateTime objects
88ef52d [Form] Improved FormType::getDefaultOptions() to see default options defined in parent types
b9facfc [Form] Removed undefined variables in exception constructor

Discussion
----------

[Form] Fixed: "date", "time" and "datetime" fields can be initialized with \DateTime objects

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

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

Fixed exception that was thrown when doing:

    $builder->add('createdAt', 'date', array('data' => new \DateTime()));

On a side note, the options passed to `FieldType::getDefaultOptions` now always also contain the default options of any parent types. This is necessary if you want to be independent of how `getDefaultOptions` is implemented in the parent type and still rely on the already defined values.

As a result, `FieldType::getParent` doesn't see default options anymore. This shouldn't be a big problem, because this method only relies on options in few cases. If it does, options now need to be checked for existence with `isset` before being used (BC break).

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

by bschussek at 2012-02-09T16:14:46Z

@fabpot Ready to merge.

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

by bschussek at 2012-02-10T12:15:04Z

@fabpot Ready to merge
2012-02-10 13:16:49 +01:00
Bernhard Schussek 2521962260 [Form] Added constant Guess::VERY_HIGH_CONFIDENCE 2012-02-10 12:01:35 +01:00
Victor Berchet d86e1eb71c [Routing] Remove a weird dependency 2012-02-10 09:49:25 +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
Fabien Potencier 7eb22a7711 [MonologBundle] moved bundle to its own repository 2012-02-09 10:22:21 +01:00
Fabien Potencier e69a30b2a5 [SwiftmailerBundle] moved the bundle to its own repository 2012-02-09 09:51:46 +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
Victor Berchet e3cf37fe84 [HttpFoundation] RedirectResponse: add the ability to retrieve the target URL, add unit tests 2012-02-06 19:09:24 +01:00
Fabien Potencier 5676a91b8d updated CHANGELOG for 2.1 2012-02-06 17:45:32 +01:00
Sebastian Hörl 411a0ccbdd [Validator] Added GroupSequenceProvider to changelog 2012-02-03 17:45:10 +01:00
Fabien Potencier 2cd246786d merged branch bschussek/issue3239 (PR #3256)
Commits
-------

8714d79 [Form] Simplified code in MergeCollectionListener
8ab982a [Form] Fixed: Custom add and remove method are not invoked if disallowed
02f61ad [Form] Renamed choice and collection options "adder_prefix" and "remover_prefix" to "add_method" and "remove_method" and allowed to specify full method names
b393774 [Form] Used direct method access in MergeCollectionListener instead of Reflection to avoid problems when using class hierarchies
d208f4e [Form] Made it possible to use models with only either addXxx() or removeXxx()

Discussion
----------

[Form] Fixed edge cases in MergeCollectionListener

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=issue3239)

Fixes an issue mentioned in the comments of #3239

see https://github.com/symfony/symfony/pull/3239#issuecomment-3776312

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

by bschussek at 2012-02-02T12:12:17Z

Wait a minute before merging this.

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

by bschussek at 2012-02-02T13:01:55Z

@fabpot Ready to merge
2012-02-02 17:28:40 +01:00
Bernhard Schussek bd461e295d [Form] Forms now don't create empty objects anymore if they are completely empty and not required. The empty data for these forms is null. 2012-02-02 14:40:19 +01:00
Bernhard Schussek 02f61adcc5 [Form] Renamed choice and collection options "adder_prefix" and "remover_prefix" to "add_method" and "remove_method" and allowed to specify full method names 2012-02-02 13:44:48 +01:00
Bernhard Schussek 9b0245b57b [Form] Made prefix of adder and remover method configurable. Adders and removers are not called if "by_reference" is disabled. 2012-02-02 11:16:57 +01:00
Bernhard Schussek 49d1464b43 [Form] Implemented MergeCollectionListener which calls addXxx() and removeXxx() in your model if found
The listener is used by the Collection type as well as the Choice and Entity type (with multiple
selection). The effect is that you can have for example this model:

    class Article
    {
        public function addTag($tag) { ... }
        public function removeTag($tag) { ... }
        public function getTags($tag) { ... }
    }

You can create a form for the article with a field "tags" of either type "collection" or "choice"
(or "entity"). The field will correctly use the three methods of the model for displaying and
editing tags.
2012-02-02 11:16:21 +01:00
Fabien Potencier 8245bf13d5 merged branch bschussek/issue2615 (PR #3228)
Commits
-------

2e4ebe4 [Validator] Renamed methods addViolationAtRelativePath() and getAbsolutePropertyPath() in ExecutionContext
9153f0e [Validator] Deprecated ConstraintValidator methods setMessage(), getMessageTemplate() and getMessageParameters()
0417282 [Validator] Fixed typos
a30a679 [Validator] Made ExecutionContext immutable and introduced new class GlobalExecutionContext
fe85bbd [Validator] Simplified ExecutionContext::addViolation(), added ExecutionContext::addViolationAt()
f77fd41 [Form] Fixed typos
1fc615c Fixed string access by curly brace to bracket
a103c28 [Validator] The Collection constraint adds "missing" and "extra" errors to the individual fields now
f904a9e [Validator] Fixed: GraphWalker does not add constraint violation if error message is empty
1dd302c [Validator] Fixed ConstraintViolationList::__toString() to not include dots in the output if the root is empty
1678a3d [Validator] Fixed: Validator::validateValue() propagates empty validation root instead of the provided value

Discussion
----------

[Validator] Improved "missing" and "extra" errors of Collection constraint

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

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

Instead of a single violation

    Array:
        The fields "foo", "bar" are missing

various violations are now generated.

    Array[foo]:
        This field is missing
    Array[bar]:
        This field is missing

Apart from that, the PR contains various minor fixes to the Validator.

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

by bschussek at 2012-02-02T09:14:52Z

@fabpot Ready for merge.
2012-02-02 10:16:32 +01:00
Fabien Potencier 687703db94 merged branch canni/command_in_process (PR #2894)
Commits
-------

e9b4c58 [Console] Enable process isolantion in Shell

Discussion
----------

[Console] Enable process isolantion in Shell

Bug fix: no
BC break: no
Feature addition: yes
Symfony2 test pass: yes
Fixes the following tickets: #2848 #2847
Todo: Write unit tests

See tickets for reference, need help with unit testing, because I don't know how to test this :)

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

by canni at 2011-12-16T09:36:32Z

I've tested this with different scenarios like "inception" (invoking shell from shell - will not work) ;) and others, everything seems to work great.

As I have no idea on how to pack this with unit testing some help needed, also as I don't have any windows in home ;) need someone to test it on MS os.
And we should decide, do we want process isolation by default? (This will not break the BC, break only the "expected behavior" - colorful output and "interactivity")

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

by canni at 2011-12-18T15:14:26Z

I've rebased this branch to match current `HEAD` and I've added usage of new process builder, for better portability an shell arg escaping.

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

by fabpot at 2012-02-02T08:28:32Z

@canni: Can you squash your commits before I merge this PR? Thanks.

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

by canni at 2012-02-02T09:07:16Z

@fabpot @stof done.
2012-02-02 10:13:02 +01:00
Fabien Potencier 5596f79c13 merged branch bschussek/changelog-fixes (PR #3248)
Commits
-------

6fefe0a [Form] Improved the CHANGELOG

Discussion
----------

[Form] Improved the CHANGELOG
2012-02-02 10:12:10 +01:00
Fabien Potencier 0f86c4585d merged branch havvg/acl-unset-parent-master (PR #3222)
Commits
-------

6a02237 add note on BC BREAK of MutableAclInterface
dbd3a1b allow unsetting parentAcl on MutableAclInterface

Discussion
----------

[Security] allow unsetting the parent ACL

Bug fix: yes
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes

The #3151 rebased onto master.
Sorry for the delay, was on vacations.

```plain
 symfony2 git:acl-unset-parent ✔  phpunit tests/Symfony/Tests/Component/Security         ~/Web Development/symfony2
PHPUnit 3.6.4 by Sebastian Bergmann.

Configuration read from /Users/havvg/Web Development/symfony2/phpunit.xml

...............................................................  63 / 428 ( 14%)
............................................................... 126 / 428 ( 29%)
............................................................... 189 / 428 ( 44%)
............................................................... 252 / 428 ( 58%)
............................................................... 315 / 428 ( 73%)
............................................................... 378 / 428 ( 88%)
.................................................

Time: 15 seconds, Memory: 49.00Mb

OK (427 tests, 1180 assertions)
```
2012-02-02 10:09:03 +01:00
Dariusz Górecki e9b4c584c0 [Console] Enable process isolantion in Shell
Bug fix: no
BC break: no
Feature addition: yes
Symfony2 test pass: yes
Fixes the following tickets: #2848 #2847
Todo: -

See tickets for reference, need help with testing, because I don't know how to test this :)
2012-02-02 10:09:00 +01:00
Fabien Potencier e71d1579d1 merged branch helmer/readonly (PR #3193)
Commits
-------

de253dd [Form] read_only and disabled attributes

Discussion
----------

[Form] read_only and disabled attributes (closes #1974)

1. Removed ``readOnly`` property from ``Form``, as it is no longer required
2. Introduced ``disabled`` property to ``Form``, behaves exactly like ``readOnly`` used to
3. Added ``disabled`` property to fields, defaults to ``false``, renders as ``disabled="disabled"``
4. A field with positive ``read_only`` property now renders as ``readonly="readonly"``

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

by helmer at 2012-01-26T17:46:17Z

I changed ``Form`` and ``FormBuilder`` property ``readOnly`` to ``disabled``. On second thought, this is perhaps not such good change - while readOnly somewhat implied the use-case, disabled no longer does.

Perhaps something else, like ``bindable`` (as not to confuse with read_only attribute of Fields)?

@bschussek, others, any thoughts?

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

by bschussek at 2012-01-31T06:53:59Z

Please prefix commits with the affected component, if applicable.

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

by helmer at 2012-01-31T08:41:03Z

@bschussek Prefixed. Please also see see to [this question](https://github.com/symfony/symfony/pull/3193#issuecomment-3673074)
2012-02-02 10:03:00 +01:00
Bernhard Schussek 6fefe0a6fb [Form] Improved the CHANGELOG 2012-02-02 10:02:49 +01:00
Eric Clemmons 534843de51 Updated CHANGELOG-2.1 to reflect imported route support of default values and requirements 2012-02-01 21:14:51 -08:00
Bernhard Schussek 9153f0e569 [Validator] Deprecated ConstraintValidator methods setMessage(), getMessageTemplate() and getMessageParameters()
Had to refactor the validation tests at the same time and fixed various small bugs while doing so.
2012-02-01 14:03:13 +01:00
Bernhard Schussek a30a679135 [Validator] Made ExecutionContext immutable and introduced new class GlobalExecutionContext
A new ExecutionContext is now created everytime that GraphWalker::walkConstraint() is
launched. Because of this, a validator B launched from within a validator A can't break
A anymore by changing the context.

Because we have a new ExecutionContext for every constraint validation, there is no point
in modifying its state anymore. Because of this it is now immutable.
2012-01-31 21:35:48 +01:00
Helmer Aaviksoo de253dd3dd [Form] read_only and disabled attributes 2012-01-31 11:51:22 +02:00
Bernhard Schussek a103c28b08 [Validator] The Collection constraint adds "missing" and "extra" errors to the individual fields now 2012-01-30 20:57:20 +01:00
Toni Uebernickel 6a022374ed add note on BC BREAK of MutableAclInterface 2012-01-30 14:24:56 +01:00
Bernhard Schussek d346ae6a8f Improved choice list sections of UPGRADE and CHANGELOG 2012-01-30 10:57:14 +01:00