Commit Graph

792 Commits

Author SHA1 Message Date
Fabien Potencier
c7ec49c624 merged branch lstrojny/feature/form-http-delete (PR #3159)
Commits
-------

0b7e2e0 Support for DELETE method in forms

Discussion
----------

[Form] Support DELETE HTTP verb

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

As `Symfony\Component\HttpFoundation\Request` already support DELETE requests nicely by parsing the request for us, support for the HTTPs DELETE verb can be easily done.

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

by mvrhov at 2012-01-20T06:00:49Z

This is wrong. The body for DELETE method is supposed to be empty or if present ignored.
Also the DELETE is supposed to remove the resource identified by uri, so the same code as for GET should be executed.

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

by lstrojny at 2012-01-20T08:56:22Z

I don’t think that’s the case. The HTTP standard does not state explicitly that DELETE does not have a body. See this [StackOverflow thread](http://stackoverflow.com/questions/2539394/rest-http-delete-and-parameters)
2012-01-22 10:05:04 +01:00
Fabien Potencier
cbb184c076 merged branch alexandresalome/fix-form-choice-translation-expanded (PR #3166)
Commits
-------

0513eb1 [Form] Pass translation domain to the sub-forms when choice list is expanded

Discussion
----------

[Form] Pass translation domain to the sub-forms when choice list is expanded

* Bug fix: yes
* Tests pass: yes
* Feature addition: no
* BC compatibility break: no

When you have a select list with ``translation_domain``, you loose translations by expanding the list.

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

by stof at 2012-01-21T14:55:31Z

👍

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

by fabpot at 2012-01-21T16:51:17Z

Why not doing that in the 2.0 branch instead?

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

by stof at 2012-01-21T17:26:32Z

@fabpot because the support of translation domains is a 2.1 feature
2012-01-21 21:20:56 +01:00
alexandresalome
0513eb1a4f [Form] Pass translation domain to the sub-forms when choice list is expanded 2012-01-21 14:19:08 +01:00
Lars Strojny
0b7e2e035a Support for DELETE method in forms 2012-01-20 01:04:31 +01:00
Dariusz Górecki
693d1ec237 [Form] Do not render default ID attribute on empty form name
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

This is cleanup after enabling empty form names, now form with empty name
will not render the default `id="form"` container attribute.
Developers can extend/override this behaviour by standard form theming methods.
2012-01-18 10:59:46 +01:00
Jonathan Ingram
076f5717a7 Added missing interface method and updated phpDoc param 2012-01-18 17:05:44 +11:00
Bernhard Schussek
0c70a410e5 [Form] Made validation of form children configurable. Set the option "cascade_validation" to true if you need it. 2012-01-16 20:49:43 +01:00
Fabien Potencier
b9a14f0411 merged 2.0 2012-01-11 15:47:52 +01:00
Fabien Potencier
7ee2f6da75 fixed some phpdoc 2012-01-11 15:46:50 +01:00
Kris Wallsmith
aa58330047 [Form] fixed flawed condition 2012-01-10 09:16:51 -08:00
Fabien Potencier
8ce034fae0 Revert "merged 2.0"
This reverts commit 7000e944fd, reversing
changes made to 9d9013d662.
2012-01-08 20:43:02 +01:00
Dariusz Górecki
3702541b5a Add tests 2012-01-07 16:30:46 +01:00
Dariusz Górecki
4f38b14e7d Remove elseif 2012-01-07 15:13:48 +01:00
Dariusz Górecki
3d20e399e9 [Form] Enable empty root form name
BC Break: no
Feature addition: yes
Symfony2 tests pass: yes
Fixes the following issues: #2790
Todo: need more testing

This PR enables usage of empty string as a form name (only at root level).
2012-01-07 15:13:48 +01:00
Fabien Potencier
7000e944fd merged 2.0 2012-01-05 14:54:04 +01:00
Fabien Potencier
208c2e468c removed the version attribute in all composer.json files 2012-01-05 14:51:20 +01:00
Fabien Potencier
7ea9c5b92a merged branch stloyd/missingClientTransformer (PR #2421)
Commits
-------

49d2685 [Form] Add default validation to TextType field (and related)

Discussion
----------

[Form] Add default transformer to TextType field (and related)

Bug fix: yes&no (?)
Feature addition: yes (?)
BC break: no
Symfony2 tests pass: yes
Fixes the following tickets: #1962.

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

by stloyd at 2011/12/19 03:43:37 -0800

@fabpot ping ;-)

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

by fabpot at 2011/12/19 10:58:20 -0800

Is it really needed? I have a feeling that it enforces unneeded constraints, but I can be wrong of course.

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

by hlecorche at 2011/12/20 02:31:03 -0800

It's needed because with TextType field, and without the ValueToStringTransformer, the user data (when sending the form) can be an array !!!

For example:
- if there is a TextType field
- and if there is a MaxLengthValidator
- and if the user data (when sending the form) is an array
So the exception "Expected argument of type string, array given in src\Symfony\Component\Validator\Constraints\MaxLengthValidator.php at line 40" is thrown
2011-12-21 12:55:51 +01:00
Fabien Potencier
5d6a7d35b0 merged 2.0 2011-12-18 14:48:17 +01:00
Fabien Potencier
4316595dbb fixed CS 2011-12-18 14:42:59 +01:00
Fabien Potencier
997f354d53 tweaked the README files 2011-12-18 14:22:28 +01:00
Fabien Potencier
0f2caf1106 merged branch lsmith77/component_readmes (PR #2561)
Commits
-------

1e370d7 typo fix
93d8d44 added some more infos about Config
27efd59 added READMEs for the bridges
34fc866 cosmetic tweaks
d6af3f1 fixed README for Console
6a72b8c added basic README files for all components

Discussion
----------

added basic README files for all components and bridges

heavily based on http://fabien.potencier.org/article/49/what-is-symfony2 and the official Symfony2 documentation

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

by jmikola at 2011/11/03 13:36:07 -0700

Great work. For syntax highlighting on the PHP snippets, you could add "php" after the three backticks.

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

by lsmith77 at 2011/11/03 13:41:29 -0700

done

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

by stealth35 at 2011/11/03 13:49:31 -0700

Nice job, but you also need to add `<?php`

ex :

``` php
<?php
use Symfony\Component\DomCrawler\Crawler;

$crawler = new Crawler();
$crawler->addContent('<html><body><p>Hello World!</p></body></html>');

print $crawler->filter('body > p')->text();
```

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

by lsmith77 at 2011/11/03 13:56:57 -0700

done

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

by ericclemmons at 2011/11/03 19:57:57 -0700

@lsmith77 Well done!  This makes consumption of individual components that much easier, *especially* now that `composer.json` files have been added.

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

by lsmith77 at 2011/11/04 01:18:23 -0700

ok .. fixed the issues you mentioned @fabpot

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

by lsmith77 at 2011/11/11 15:00:27 -0800

@fabpot anything else left? seems like an easy merge .. and imho there is considerable benefit for our efforts to spread the word about the components with this PR merged.

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

by drak at 2011/11/11 18:54:13 -0800

You know, it might be a nice idea to put a link to the documentation for each component if there is some at symfony.com

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

by lsmith77 at 2011/11/12 00:59:14 -0800

i did that in some. but i might have missed a few places.
On 12.11.2011, at 03:54, Drak <reply@reply.github.com> wrote:

> You know, it might be a nice idea to put a link to the documentation for each component if there is some at symfony.com
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/2561#issuecomment-2715762

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

by breerly at 2011/11/21 10:28:36 -0800

Pretty excited with this.

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

by dbu at 2011/11/24 00:02:50 -0800

is there anything we can help with to make this ready to be merged?

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

by lsmith77 at 2011/12/18 02:39:23 -0800

@fabpot: seriously .. if you are not going to deliver something "better" and don't provide a reason what is wrong with this .. then its beyond frustrating. i obviously do not claim that these README's are perfect (and certainly still no replacement for proper documentation), but I do claim that in their current form they are a radical step forward to potential users of the Symfony2 components.
2011-12-18 12:42:02 +01:00
Fabien Potencier
2750adb52d Merge branch '2.0'
* 2.0:
  [FrameworkBundle] Added functional tests.
  [Form] Added missing use statements (closes #2880)
  [Console] Improve input definition output for Boolean defaults
  [SecurityBundle] Changed environment to something unique.
  2879: missing space between catch and the brace
  #2688: Entities are generated in wrong folder (doctrine:generate:entities Namespace)
  [TwigBundle] Fix the exception message escaping
2011-12-15 18:17:38 +01:00
Joseph Bielawski
49d2685bff [Form] Add default validation to TextType field (and related) 2011-12-15 13:49:39 +01:00
Joseph Bielawski
8069ea69dd [Form] Added missing use statements (closes #2880) 2011-12-15 10:01:35 +01:00
Fabien Potencier
142cef21bb merged 2.0 2011-12-13 16:12:53 +01:00
Bart van den Burg
d97d7e93c0 Added a check to see if the type is a string if it's not a FormTypeInterface 2011-12-13 12:27:51 +01:00
Fabien Potencier
e3421a0b1d [DoctrineBridge] fixed some CS 2011-12-13 10:22:12 +01:00
Fabien Potencier
c35c321e54 merged branch francisbesset/form_error_message (PR #2748)
Commits
-------

9e6a10a [Form] Added FormError::getMessage() and use it in Form class

Discussion
----------

[Form] Added FormError::getMessage()

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

by ericclemmons at 2011/11/29 18:38:40 -0800

Should this go through the translator, similar to how `field_errors` renders error messages?

> https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig#L253

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

by stof at 2011/11/29 23:11:24 -0800

``getErrorsAsString`` is there for a debugging purpose so injecting the translator in the Form class just for it seems wrong. And the logic used here is exactly what the identity translator does.
2011-12-01 08:39:32 +01:00
Helmer Aaviksoo
0b5c4b29c2 [Form] Date, Time, DateTimeType forget translation domain 2011-11-30 10:55:10 +02:00
Francis Besset
9e6a10a60e [Form] Added FormError::getMessage() and use it in Form class 2011-11-29 18:26:32 +01:00
Eric Clemmons
7a8e1b3b48 ChoiceType flattens nested Choices when expanded 2011-11-26 17:37:27 -08:00
Fabien Potencier
a7f7be2309 merged 2.0 2011-11-23 23:28:22 +01:00
Jordi Boggiano
c76487ee04 Fix composer.json files to be stricter 2011-11-23 17:51:23 +01:00
Jordi Boggiano
e7215aeb40 Fix composer.json 2011-11-23 16:10:32 +01:00
Fabien Potencier
a1d12324f9 merged 2.0 2011-11-23 11:23:27 +01:00
Fabien Potencier
bb025bb904 merged branch hlecorche/valid-form-w3c (PR #2676)
Commits
-------

78e9b2f [Form] Fixed textarea_widget (W3C standards)

Discussion
----------

[Form] Fixed textarea_widget (W3C standards)

Textarea widget included the "pattern" attribute but is not valid by W3C standards.

(See PR 2666 - New PR because rebase inside the 2.0 branch)

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

by fabpot at 2011/11/18 09:01:41 -0800

@hlecorche: Thanks for your work on this issue. Can you update the unit tests to be sure that this case is covered? If you're not comfortable with this, just tell me and I will do it myself

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

by hlecorche at 2011/11/19 02:51:06 -0800

@fabpot: I did'nt commited because I am not sure. I changed the "tests/Symfony/Tests/Component/Form/AbstractLayoutTest.php" file :

    public function testTextarea()
    {
        $form = $this->factory->createNamed('textarea', 'na&me', 'foo&bar', array(
            'property_path' => 'name',
            'pattern' => 'foo',
        ));

        $this->assertWidgetMatchesXpath($form->createView(), array(),
    '/textarea
    [@name="na&me"]
    [not(@pattern)]
    [.="foo&bar"]
    '
        );
    }

Is it correct?
2011-11-22 10:25:58 +01:00
Fabien Potencier
48c0f50fa2 [Form] tweaked an exception message 2011-11-22 10:24:03 +01:00
Fabien Potencier
af2713261d merged branch canni/throw_exception_on_form_name_circulal_ref (PR #2675)
Commits
-------

36cebf0 Fix infinite loop on circullar reference in form factory

Discussion
----------

[BugFix][Form]Throw exception on form name circulal ref

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

When FormType method `getName()` returns the same value as `getParent()` we're asking about trouble, and land into infinite loop.
2011-11-22 10:21:50 +01:00
Fabien Potencier
a8fd2c4b46 merged 2.0 2011-11-22 10:13:00 +01:00
Fabien Potencier
a8e8008df3 merged branch greg0ire/patch-1 (PR #2604)
Commits
-------

5b30812 See this issue : https://github.com/symfony/symfony/issues/2433

Discussion
----------

See this issue : https://github.com/symfony/symfony/issues/2433

I changed the access speficiers to `protected`, which makes easier to extend this class if one needs to like I did.

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

by greg0ire at 2011/11/10 06:55:12 -0800

Precision on the problem I had : I wanted to use a `CollectionType` and display a collection element attribute as the label for this element. I had no choice but to extend `ResizeFormListener` and `CollectionType`.
2011-11-22 10:10:56 +01:00
Fabien Potencier
7c8d836331 merged branch willdurand/undefined-value-property-path (PR #2266)
Commits
-------

57e1aeb Fixed undefined index notice in readProperty() method (PropertyPath)

Discussion
----------

Fixed undefined index notice in readProperty() method (PropertyPath)

Hi,

For some reasons, I get `notice` errors on `readProperty()` with Propel:

    Notice: Undefined index: 0 in /Users/william/projects/Propel/testProjects/symfony2/vendor/symfony/src/Symfony/Component/Form/Util/PropertyPath.php line 284

The `PropelObjectCollection` implements `ArrayAccess`, the `readProperty()` method does not check if the given `index` exists so the `notice` error is thrown. I suppose to check whether the index exists or not has to be added.

Regards,
William

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

by fabpot at 2011/09/27 23:42:07 -0700

The patch is probably not what we want to do. First, I suppose that you are not creating the propertyPath by hand. If that is the case, we need to understand why the property path does not exist. Then, even if we might want to check the existence of the index, if it does not exist, we should probably throw an exception instead of just ignoring the problem.

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

by willdurand at 2011/09/28 01:14:49 -0700

My bad. This is a Propel bug due to `ArrayObject`. It throws a notice error if the index is not found in `offsetGet()` which is wrong according to the `ArrayAccess` interface. If the index is not found, we have to return `null`.

@fabpot Are you agree with that (for the `null` value) ?

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

by fabpot at 2011/09/28 01:17:09 -0700

My point is that it should never happen under normal circumstances.

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

by willdurand at 2011/09/28 01:23:55 -0700

@fabpot Not sure to get it.

The fact is that it tries to get the value (`getValue()`) of a fresh object, just added to the `collection` when I'm submitting a form with a `CollectionType` and a new entry in it.
I mean it tries to get this new object (not yet persisted, not yet in the collection) in the collection (`getValue()` -> `readProperty()`) which implements `ArrayAccess` but this object cannot be in the collection at this time.

Am I wrong ?

And, without this notice error thrown by Propel, I probably never opened this issue...

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

by willdurand at 2011/09/29 06:40:34 -0700

@fabpot: you can try this example: http://www.propelorm.org/cookbook/symfony2/mastering-symfony2-forms-with-propel.html#manytomany_relations in order to make your own tests. Will it be enough?
As I said, it throws a weird notice for the reasons above.

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

by jaugustin at 2011/10/04 12:58:10 -0700

any news on this ?
@fabpot did you have time to look at the test case ?

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

by cedriclombardot at 2011/11/09 14:29:42 -0800

@fabpot: can we have news about this ?
2011-11-22 09:55:47 +01:00
hlecorche
78e9b2fedb [Form] Fixed textarea_widget (W3C standards) 2011-11-18 17:31:57 +01:00
Dariusz Górecki
36cebf0924 Fix infinite loop on circullar reference in form factory
When `->getName()` returns the same as `getParent()` we're going to infinite loop.
2011-11-18 14:23:22 +01:00
Fabien Potencier
12299c4de9 merged branch kriswallsmith/form/checkbox-view (PR #2661)
Commits
-------

79ae3fc [Form] fixed radio and checkbox when data is not bool

Discussion
----------

[Form] fixed checkbox view

The checkbox view was being built based on app data, not client data. This fixes it.

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

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

by fabpot at 2011/11/16 13:31:09 -0800

`RadioType` suffers from the same problem, no?

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

by kriswallsmith at 2011/11/16 13:32:50 -0800

Yeah, I'll fix that too.

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

by kriswallsmith at 2011/11/16 13:43:29 -0800

Updated to include `RadioType`.
2011-11-17 07:05:47 +01:00
Fabien Potencier
d1ae6c7cb6 bumped Symfony version in composer.json files to 2.0.7 2011-11-17 06:58:47 +01:00
Kris Wallsmith
79ae3fced9 [Form] fixed radio and checkbox when data is not bool 2011-11-16 13:39:36 -08:00
Fabien Potencier
c681b68bde Merge branch '2.0'
* 2.0:
  [FrameworkBundle] fixed a unit test
  [Form] Check for normal integers. refs 0427b126c1
  [Form] Replace `an` with `is`
2011-11-12 09:18:01 +01:00
Manuel de Ruiter
462580c06f [Form] Check for normal integers. refs 0427b126c1 2011-11-12 00:58:46 +01:00
Manuel de Ruiter
970e2a2608 [Form] Replace an with is 2011-11-12 00:57:14 +01:00
Fabien Potencier
21cec043d7 Merge branch '2.0'
* 2.0:
  [Form] fixed previous merge
  [Form] simplified previous merge
  Also identify FirePHP by the X-FirePHP-Version header
  [TwigBundle] Extract output buffer cleaning to method
  [TwigBundle] Do not clean output buffering below initial level
  Fixed rendering of FileType (value is not a valid attribute for input[type=file])
  Added tests for string fix in DateTimeToArrayTransformer (8351a11286).
  Added check for array fields to be integers in reverseTransform method. This prevents checkdate from getting strings as arguments and throwing incorrect ErrorException when submitting form with malformed (string) data in, for example, Date field. #2609
  [Translation] removed unneeded methods
  [Translation] added detection for circular references when adding a fallback catalogue
  [DomCrawler] trim URI in getURI
  [Yaml][Tests] Fixed missing locale string for Windows platforms which caused test to fail
2011-11-11 22:52:07 +01:00