Commit Graph

8184 Commits

Author SHA1 Message Date
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 569b6dbd13 merged branch hason/formbuilder (PR #3249)
Commits
-------

7cecb4e [Form] added support for parent of FormBuilder

Discussion
----------

[Form] added support for parent of FormBuilder

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

In some cases of building forms, it is good to know the attributes of the parent builder. In my case I want to automaticaly add the subscriber to the fields, whose parent builder has a concrete attribute.

Replace #2882
2012-02-02 10:13:41 +01:00
Bernhard Schussek 2e4ebe444f [Validator] Renamed methods addViolationAtRelativePath() and getAbsolutePropertyPath() in ExecutionContext 2012-02-02 10:13:41 +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
Martin Hasoň 7cecb4e71e [Form] added support for parent of FormBuilder 2012-02-02 10:09:50 +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
Sebastian Bergmann 253a8ff016 [DependencyInjection] split a test 2012-02-02 09:51:16 +01:00
Fabien Potencier 1c3e6c2cb2 merged branch sellingsource/EXPOSE_FORM_VALIDATORS (PR #2983)
Commits
-------

601d462 [Form] Added getValidators() to Form class

Discussion
----------

[Form] Added getValidators() to Form class

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

I am working implementing client side validation in a bundle that adds validation rules via a form builder. I am currently unable to pull the validators from the Form class which is making the implementation incredibly difficult.

I noticed that the transformers are currently exposed and based on some feedback I got on IRC I am guessing these weren't exposed simply because no one needed them at the time.

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

by mlively at 2011-12-28T20:54:41Z

Side note: It would be incredibly helpful to have this in the current branch of symfony. I implemented it on master because it is a new feature, but I would be more than happy to patch it into 2.0 if you would like.

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

by canni at 2012-01-11T10:15:46Z

👍

As this is new feature it cannot fit into 2.0 series, but 2.1 is just few clicks ahead, maybe this feature will  fit into  ;)

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

by bschussek at 2012-01-31T08:23:05Z

ping @fabpot
👍

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

by stof at 2012-01-31T08:51:26Z

@mlively could you rebase your branch ? it conflicts with the current master

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

by mlively at 2012-01-31T21:38:39Z

Yes, I can do that might be later today.
2012-02-02 09:36:07 +01:00
Fabien Potencier b048596e3d merged branch drublic/master (PR #3242)
Commits
-------

2374e54 Break paths in exceptions hard with css if necessary

Discussion
----------

Exceptions: Break source-paths with CSS

Sometimes in exceptions absolute paths of files are pretty long and need more than one line.

eg.: `/Volumes/Macintosh HD/Users/blabla/Sites/project/files/src/SomeProjectsName/SomeProjectsNameFrontendBundle/Controller/CreateController.php`

This should be displayed within the width of the `h1`.

Using CSS `word-break: break-all;`.
2012-02-02 09:16:47 +01:00
Fabien Potencier 42dbdd9f3d merged branch ericclemmons/3194-router-prefix-imports (PR #3245)
Commits
-------

534843d Updated CHANGELOG-2.1 to reflect imported route support of default values and requirements
3c28ab7 No prefix is required to override imported RouteCollections
c373d5b Added RouteCollectionTest#testAddCollectionOverridesDefaultsAndRequirements

Discussion
----------

[Router] RouteCollection `prefix` optional for default values/requirements

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

[![Build Status](https://secure.travis-ci.org/ericclemmons/symfony.png)](https://secure.travis-ci.org/ericclemmons/symfony.png)

With the commit 2e1344eb7e (thanks @vicb!), imported routes could have `defaults` and `requirements` set, but only as long as there is a `prefix`.

Thisfix allows any imported route to have defaults set, whether or not `prefix` is set.

(See #3194 for specifics)

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

by vicb at 2012-02-02T06:01:51Z

Behavior is now consistent.

_FYI, You should thank `git-dag` here, `gitk` & `git-cola` are also helpful to filter commits._
2012-02-02 07:50:10 +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
Eric Clemmons 3c28ab7abd No prefix is required to override imported RouteCollections 2012-02-01 21:10:50 -08:00
Eric Clemmons c373d5b656 Added RouteCollectionTest#testAddCollectionOverridesDefaultsAndRequirements 2012-02-01 21:10:50 -08:00
drublic 2374e54e1c Break paths in exceptions hard with css if necessary
Using `word-break: break-all;`

Signed-off-by: drublic <hans@sa-designz.de>
2012-02-01 23:13:45 +01:00
Fabien Potencier b91240bdbe merged branch Burgov/fix_entity_choice_list (PR #3234)
Commits
-------

b228942 fix for entity choice list when ->loaded is false and the class name is an entity shorthand name and updated tests to work with refactored choicelist

Discussion
----------

fix for entity choice list when ->loaded is false and the class name is ...

...an entity shorthand name

This bug was reintroduced after the latest choicelist refactoring and was originally fixed in 231e79ce0f

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

by stof at 2012-02-01T15:17:37Z

Please also add a unit test for this to avoid further regressions

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

by stof at 2012-02-01T17:05:31Z

btw, a better fix would be to put the real class name in ``$this->class`` to avoid doing it each time (you are doing it in a loop btw). We don't need to keep the short notation anyway

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

by Burgov at 2012-02-01T17:19:01Z

@stof done, thanks for the comments
2012-02-01 20:35:44 +01:00
Fabien Potencier d162243082 merged branch LennyLinux/master (PR #3236)
Commits
-------

4bc0c67 [HttpFoundation] fix a small copy and paste error

Discussion
----------

Just a small copy and paste error...

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets:
Todo:
2012-02-01 20:35:02 +01:00
Bart van den Burg b228942ac8 fix for entity choice list when ->loaded is false and the class name is an entity shorthand name
and updated tests to work with refactored choicelist
2012-02-01 19:13:06 +01:00
Jörg Rühl 4bc0c672df [HttpFoundation] fix a small copy and paste error 2012-02-01 17:25:43 +01: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 0417282740 [Validator] Fixed typos 2012-02-01 09:21:22 +01:00
Fabien Potencier 6de3446424 merged branch rdohms/patch-1 (PR #3232)
Commits
-------

7b79cc2 Fixing typo in XLIFF Dumper

Discussion
----------

Fixing typo in XLIFF Dumper

There was a typo in the service name for the XLIFF Dumper
2012-02-01 07:44:03 +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
Bernhard Schussek fe85bbdb06 [Validator] Simplified ExecutionContext::addViolation(), added ExecutionContext::addViolationAt() 2012-01-31 18:42:14 +01:00
Rafael Dohms 7b79cc2d23 Fixing typo in XLIFF Dumper 2012-01-31 18:20:05 +01:00
Fabien Potencier 4682b096f6 merged branch bschussek/issue3156 (PR #3218)
Commits
-------

57cc531 [Form] Improved PHPDocs of choice lists
9e7e2af [Form] Fixed PHPDoc: Used {@inheritdoc} where applicable
2c530cc Fixed typos in UPGRADE file
7899bea Added examples to UPGRADE
d346ae6 Improved choice list sections of UPGRADE and CHANGELOG
a676598 [Form] Added class LazyChoiceList

Discussion
----------

[Form] Added LazyChoiceList

Bug fix: no
Feature addition: yes
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=issue3156)

Adds a ChoiceList implementation that satisfies people who formerly extended ArrayChoiceList and loaded choices lazily in its `load` method.

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

by craue at 2012-01-30T12:56:49Z

👍

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

by craue at 2012-01-30T14:55:38Z

Not sure if it's a bug in this PR or in #3156, but the labels get replaced by their keys:

```php
<?php

use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
use Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList;
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;

class MyChoiceList extends LazyChoiceList {
	protected function loadChoiceList() {
		$choices = array(
			'bla' => 'blaaaaaahhhh',
		);
		return new SimpleChoiceList($choices, array(), ChoiceList::COPY_CHOICE, ChoiceList::COPY_CHOICE);
	}

	public function getChoices() {
		$choices = parent::getChoices();

		// $choices is array('bla' => 'bla')

		return $choices;
	}
}
```

If it's not this PR, I can of course open a new ticket for that. But I'm only working with `LazyChoiceList`s.

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

by stof at 2012-01-30T16:07:41Z

@craue the ``SimpleChoiceList`` is an implementation using the same string as label and value. If you need different ones, you need to use the ``ChoiceList`` implementation.

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

by craue at 2012-01-30T16:22:06Z

@stof: That would make `SimpleChoiceList` useless for almost any case. Are you sure?

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

by craue at 2012-01-30T16:33:31Z

The bug even occurs when using

```
return new ChoiceList(array_keys($choices), array_values($choices), array(), ChoiceList::COPY_CHOICE, ChoiceList::COPY_CHOICE);
```

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

by stof at 2012-01-30T16:40:19Z

well, the SimpleChoiceList is for simple cases (thus its naming) where you want the same for the label and the values. And if you look at the class, you will see it extends the ChoiceList implementation which is the generic one.

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

by craue at 2012-01-30T16:53:36Z

For me, "simple" would mean that it just takes the array given, using keys as indices and values as labels. No fancy stuff messing around with anything. :D But, is there anything wrong in this code or in mine? @bschussek: Please enlighten me.

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

by bschussek at 2012-01-30T17:16:58Z

You are both wrong :) `getChoices` does not return the choices with their associated labels anymore. What you get now are the choice indices as array keys and the choice values as array values. How both are determined depends on the index and value generation strategy, which, in your case, are both COPY_CHOICE.

The difference between simple and complex choice lists is, that simple choice lists can only contain scalar values as choices, while other choice lists (such as ObjectChoiceList, EntityChoiceList) may contain objects as choices.

Choice labels are now stored in ChoiceView objects, which are returned by the various `get*Views` methods.

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

by craue at 2012-01-30T18:07:43Z

It's pretty annoying having provided an array with keys and values when initializing the `ChoiceList` but being unable to retrieve it again. Guess I just over-used or even abused those choice lists as kind of (not only form related) lookup tables.

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

by bschussek at 2012-01-30T19:27:21Z

@craue: What's your use case?

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

by craue at 2012-01-30T20:10:16Z

I just used choice lists extensively, even for not directly form-related stuff. In one case, I'm using two of them (which are also used individually) to build up a third one. That went well using the old `ArrayChoiceList`s and their `getChoices` method. Just thinking about creating another set of model classes which just contain my lists. So for only one select field in a form it'll take three classes then: (A) a list, (B) a choice list based on A, (C) a choice form type based on B. Oh well ... :D

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

by craue at 2012-01-30T21:31:32Z

Anyway, this PR for `LazyChoiceList` is great, so please merge it. ;)

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

by craue at 2012-01-31T14:00:46Z

@bschussek: Is it ready to be merged?

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

by bschussek at 2012-01-31T16:59:17Z

Yes
2012-01-31 18:09:24 +01:00
Helmer Aaviksoo de253dd3dd [Form] read_only and disabled attributes 2012-01-31 11:51:22 +02:00
Bernhard Schussek f77fd416c8 [Form] Fixed typos 2012-01-31 07:45:20 +01:00
Bernhard Schussek 1fc615cdcb Fixed string access by curly brace to bracket
This seems to be the version officially favored by PHP:
http://www.php.net/manual/en/language.types.string.php#language.types.string.substr
2012-01-31 07:39:54 +01: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
Bernhard Schussek f904a9ed53 [Validator] Fixed: GraphWalker does not add constraint violation if error message is empty 2012-01-30 20:56:10 +01:00
Bernhard Schussek 1dd302cbea [Validator] Fixed ConstraintViolationList::__toString() to not include dots in the output if the root is empty 2012-01-30 18:43:47 +01:00
Bernhard Schussek 1678a3dbdf [Validator] Fixed: Validator::validateValue() propagates empty validation root instead of the provided value 2012-01-30 18:43:47 +01:00
Bernhard Schussek 57cc531385 [Form] Improved PHPDocs of choice lists 2012-01-30 18:39:44 +01:00
Bernhard Schussek 9e7e2af087 [Form] Fixed PHPDoc: Used {@inheritdoc} where applicable 2012-01-30 18:21:53 +01:00
Fabien Potencier ce5cdaddea merged branch vicb/event.dispatcher (PR #3220)
Commits
-------

307f17d [FrameworkBundle] Code factorization in TraceableEventDispatcher

Discussion
----------

[FrameworkBundle] Code factorization in TraceableEventDispatcher
2012-01-30 15:11:06 +01:00
Fabien Potencier 5805d9f1f6 merged branch craue/patch-17 (PR #3214)
Commits
-------

9db6c8d print info about environment and debug mode when running the `CacheWarmupCommand`

Discussion
----------

print info about environment and debug mode when running the `CacheWarmupCommand`

Adapted from `CacheClearCommand`. Replaces #3212.
2012-01-30 15:09:36 +01:00
Fabien Potencier 2662ab8ee7 merged branch bschussek/issue3219 (PR #3221)
Commits
-------

5aa5987 [Form] Fixed: form children are always validated in group "Default"

Discussion
----------

[Form] Fixed: form children are always validated in group "Default"

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

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

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

by bschussek at 2012-01-30T12:44:43Z

@craue: Can you verify whether this PR fixes your problem?

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

by craue at 2012-01-30T12:53:59Z

Yeah, it does. 👍
2012-01-30 15:02:48 +01:00
Toni Uebernickel 6a022374ed add note on BC BREAK of MutableAclInterface 2012-01-30 14:24:56 +01:00
Toni Uebernickel dbd3a1bcc0 allow unsetting parentAcl on MutableAclInterface 2012-01-30 14:16:44 +01:00
Bernhard Schussek 5aa5987aa4 [Form] Fixed: form children are always validated in group "Default" 2012-01-30 13:42:13 +01:00
Bernhard Schussek 2c530cc236 Fixed typos in UPGRADE file 2012-01-30 13:36:34 +01:00
Victor Berchet 307f17d33b [FrameworkBundle] Code factorization in TraceableEventDispatcher 2012-01-30 12:56:55 +01:00
Bernhard Schussek 7899bea3e5 Added examples to UPGRADE 2012-01-30 11:10:25 +01:00
Bernhard Schussek d346ae6a8f Improved choice list sections of UPGRADE and CHANGELOG 2012-01-30 10:57:14 +01:00
Bernhard Schussek a676598d74 [Form] Added class LazyChoiceList 2012-01-30 10:56:58 +01:00
Christian Raue 9db6c8d28a print info about environment and debug mode when running the `CacheWarmupCommand` 2012-01-29 22:53:47 +01:00