Commit Graph

2468 Commits

Author SHA1 Message Date
Fabien Potencier
24778553cd [HttpFoundation] simplified code 2011-06-14 16:07:18 +02:00
Fabien Potencier
b763d667f5 merged branch lsmith77/checkIp (PR #1322)
Commits
-------

2f04bdb make checkIp() reuseable

Discussion
----------

[RequestMatcher] make checkIp() reuseable
2011-06-14 15:59:49 +02:00
Fabien Potencier
397fad3810 [Routing] added missing public @api 2011-06-14 15:40:43 +02:00
Fabien Potencier
72483f946b [Routing] tagged the public @api 2011-06-14 15:35:32 +02:00
Lukas Kahwe Smith
2f04bdb3c5 make checkIp() reuseable 2011-06-14 15:31:52 +02:00
Fabien Potencier
59301a93d7 [ClassLoader] tweaked public @api 2011-06-14 15:20:59 +02:00
Fabien Potencier
54e054b2d1 [DomCrawler] tweaked public @api 2011-06-14 15:16:43 +02:00
Fabien Potencier
dd23402e94 [EventDispatcher] tweaked public @api 2011-06-14 14:40:48 +02:00
Fabien Potencier
c6cc427e4b [EventDispatcher] added a way to set the priority for event subscribers 2011-06-14 14:40:27 +02:00
Fabien Potencier
b76a1c3077 [Finder] added a convenience method Finder::create() 2011-06-14 14:18:24 +02:00
Fabien Potencier
1ad5bfd723 [CssSelector] renamed SyntaxError 2011-06-14 14:12:03 +02:00
Fabien Potencier
d87c96bb65 [CssSelector] ... 2011-06-14 13:06:37 +02:00
Fabien Potencier
a232c148eb fixed CS 2011-06-14 12:54:32 +02:00
Fabien Potencier
a7c1ff8558 merged branch ajessu/time_validator (PR #1254)
# Commits

ca52a04 [Validator] Allow DateTime objects as valid Times

# Discussion

## [Validator] Allow DateTime objects as valid Times

Also added tests for `DateTime` objects as valid on `Date` and `Time` constraints.

I didn't include the test for the `DateTime` constraint, as it's already included in this PR:

https://github.com/symfony/symfony/pull/1085

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

## fabpot @ 2011/06/09 09:07:21 -0700

I don't think it makes sense to use a \DateTime instance to represent a Time.

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

## ajessu @ 2011/06/09 09:33:20 -0700

If I have an entity with a doctrine type `Time`:

    Time (DateTime instance where only H:i:s get persisted)

```php
<?php
    /**
     * @ORM\Column(type="time")
     * @Assert\Time()
     */
    protected $startTime;
```

and I create a form out of this Entity, a `DateTime` object is passed when the form is submitted.

This generates an `UnexpectedTypeException`.

I just made this change to match the `Date` validator with the doctrine type `Date`, which also shares this behavior:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/DateValidator.php#L28

    Date (DateTime instance where only Y-m-d get persisted)
2011-06-14 12:08:41 +02:00
Victor Berchet
38b3b7474f [HttpKernel] Fix and test previous commit 2011-06-14 11:54:55 +02:00
Victor Berchet
ac0c00c6e8 [HttpFoundation] Make File extends \SplFileInfo 2011-06-14 10:47:04 +02:00
Victor Berchet
87ca9f3a52 [Validation] some tweaks and phpDoc 2011-06-14 09:40:26 +02:00
Victor Berchet
4e3e2768fb [Form] Make the prototype view child of the collection view 2011-06-14 09:33:19 +02:00
Fabien Potencier
c364008a3b [Form] allowed an empty value to be displayed for choices even when required is true
Rules are as follows:

* If multiple is true, then the empty_value is ignored
* If not, and if the field is not required, the empty_value is set to the empty string by default and displayed
* If the field is required, and if the user explicitely set the empty_value, then it is displayed
2011-06-14 08:27:19 +02:00
Ryan Weaver
52cbbfe0d3 [HttpKernel] Adding small example of how the extension alias is auto-generated 2011-06-13 17:16:49 -05:00
Fabien Potencier
a12ea12fc1 fixed CS 2011-06-13 18:54:20 +02:00
Fabien Potencier
d16a708cc8 [Form] simplified file type class
File uploads documentation is here:

https://github.com/symfony/symfony-docs/pull/400
2011-06-13 18:11:18 +02:00
Fabien Potencier
196350b892 Merge remote branch 'djama/patch-1'
* djama/patch-1:
  call header() with replace=false, to provide the possibility of sending mutiple headers of the same type.
2011-06-13 12:19:40 +02:00
Fabien Potencier
0c29a25d89 Merge remote branch 'kriswallsmith/form/collection-proto'
* kriswallsmith/form/collection-proto:
  added script[type="text/html"] collection prototype to form themes
  [Form] removed collection prototype from form tree
2011-06-13 11:51:18 +02:00
Fabien Potencier
41b7190efc Revert "[Form] changed the way default type names are created to avoid collisions"
This reverts commit d044498cde.

The reason for reverting is that the name is actually used to customize
the template on a per field basis:

{% block _post_excerpt_widget %}
    ***{{ block('text_widget') }}***
{% endblock %}

Here, post is the name of the Type.
2011-06-13 11:47:21 +02:00
Fabien Potencier
0fc56346f7 Merge remote branch 'AurelC2G/fix-charset'
* AurelC2G/fix-charset:
  [HttpFoundation] Fixed indentation
  [HttpFoundation] Fixed charset always being set to UTF-8
2011-06-13 11:22:46 +02:00
Fabien Potencier
b72f980fac Merge remote branch 'brikou/phpdoc_formType'
* brikou/phpdoc_formType:
  [Form] added phpdoc (inherit) for types
2011-06-13 11:20:57 +02:00
Lee McDermott
49dd558444 Couple more CS fixes 2011-06-13 02:40:21 +01:00
Kris Wallsmith
5b0f1da074 [HttpKernel] made WebTestCase methods static 2011-06-11 08:50:27 -07:00
Lee McDermott
5a986bfc27 Add $keysCount & minor CS fix 2011-06-11 16:43:28 +01:00
Lee McDermott
91f4097a09 [Routing] Better nesting for RouteCollections in dumped URL matcher classes
With this change, a route prefixed with '/blogger' will be nested inside '/blog' (for example)
2011-06-11 16:11:55 +01:00
Brikou CARRE
66ae994528 [Form] added phpdoc (inherit) for types 2011-06-11 11:59:28 +02:00
Brikou CARRE
3dff029c37 [Session] added phpdoc about flash messages 2011-06-11 11:44:30 +02:00
Aurélien Fredouelle
6ae2bdeabd [HttpFoundation] Fixed indentation 2011-06-11 10:24:44 +02:00
Aurélien Fredouelle
1e50a553d2 [HttpFoundation] Fixed charset always being set to UTF-8
Fixes #1281
2011-06-11 10:22:26 +02:00
Joseph Bielawski
6bb9075b35 Remove unused code from DateTime constraint 2011-06-11 01:18:16 -07:00
Fabien Potencier
96045739b1 [TwigBundle] removed the extensions setting 2011-06-11 07:50:14 +02:00
Fabien Potencier
afa30d9864 Merge remote branch 'theinterned/patch-1'
* theinterned/patch-1:
  made logoutPath localizable as well
  storing localized targetPath in a string as opposed to updating the attribute
  In the spirit of 882a8e3f09 allow for localized logout target url
2011-06-11 07:39:04 +02:00
Fabien Potencier
c79e51c9aa Merge remote branch 'kriswallsmith/form/lazier-csrf-token'
* kriswallsmith/form/lazier-csrf-token:
  [Form] fixed xpath
  [Form] moved csrf listener to its own class
  fix issue with csrf token not present on collection fields because of resize listener
2011-06-11 07:36:51 +02:00
Fabien Potencier
8d58826085 [Routing] fixed unit tests for previous commit 2011-06-11 07:33:55 +02:00
Fabien Potencier
96554e645a Merge remote branch 'lmcd/master'
* lmcd/master:
  $code referenced but not defined in compileRoute()
  [Routing] Optimised the PHP URL matcher dumper The cached URL matcher classes contain some unneeded logic. Consider the following example:
2011-06-11 07:32:22 +02:00
Lee McDermott
2c0efa7488 $code referenced but not defined in compileRoute() 2011-06-11 04:38:11 +01:00
Lee McDermott
10bb4ff25e [Routing] Optimised the PHP URL matcher dumper
The cached URL matcher classes contain some unneeded logic. Consider the following example:

if (0 === strpos($pathinfo, '/Blog')) {
    // blog_index
    if (0 === strpos($pathinfo, '/Blog') && preg_match('#^/Blog/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {
        return array_merge($this->mergeDefaults($matches, array (  '_action' => 'index',)), array('_route' => 'blog_index'));
    }
}

The 2nd strpos is not required, as we have already satisfied this condition in the parent if statement.
My change will produce the following code for the same routing setup::

if (0 === strpos($pathinfo, '/Blog')) {
    // blog_index
    if (preg_match('#^/Blog/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) {
        return array_merge($this->mergeDefaults($matches, array (  '_action' => 'index',)), array('_route' => 'blog_index'));
    }
}
2011-06-11 01:20:22 +01:00
Ned Schwartz
47df88bfc9 made logoutPath localizable as well 2011-06-10 15:04:50 -07:00
Ned Schwartz
8fd4158468 storing localized targetPath in a string as opposed to updating the attribute 2011-06-10 14:32:10 -07:00
Kris Wallsmith
fe4382eb73 [Form] moved csrf listener to its own class 2011-06-10 13:00:44 -07:00
Ned Schwartz
17b7b558ce In the spirit of 882a8e3f09 allow for localized logout target url 2011-06-10 12:24:27 -07:00
Bulat Shakirzyanov
cb53414e91 fix issue with csrf token not present on collection fields because of resize listener 2011-06-10 11:12:35 -07:00
djama
96359fb86d call header() with replace=false, to provide the possibility of sending mutiple headers of the same type. 2011-06-10 09:16:33 -07:00
Fabien Potencier
4da7909f9a Merge remote branch 'kriswallsmith/form/is-valid-read-only'
* kriswallsmith/form/is-valid-read-only:
  [Form] fixed isValid() on readOnly forms that have children
2011-06-10 16:32:50 +02:00
Kris Wallsmith
8d55df42de [Form] fixed isValid() on readOnly forms that have children 2011-06-10 07:11:50 -07:00
Fabien Potencier
37cd020040 Merge remote branch 'lsmith77/serializer_tweaks'
* lsmith77/serializer_tweaks: (22 commits)
  clarified that BC is broken in the Serializer component
  added UPDATE notes for Serializer component changes
  fix tests
  marked public api
  more encoder lazy loading tweaks
  always use getEncoder() to enable lazy loading
  cosmetic tweak
  removed setEncoder/removeEncoder/addNormalizer/removeNormalizer
  SerializerAwareInterface and DecoderInterface do not implement EncoderInterface anymore
  handle non objects
  moved the methods that can later be moved to a Builder to the bottom
  use getEncoder inside encode/decode
  made serialize/deserialize/encode/decode final
  added Constructor
  added Exception's from SerializerBundle
  made (de)normalizeObject() private
  renamed hasEncoder/hasDecoder to supportsSerialization/supportsDeserialization
  notice fixes
  typo fixes
  all encoders implement EncoderInterface
  ...
2011-06-10 15:56:35 +02:00
Fabien Potencier
44816ebca0 Merge remote branch 'Infranology/minor-code-simplification'
* Infranology/minor-code-simplification:
  [Form] minor code simplification
2011-06-10 15:55:26 +02:00
Fabien Potencier
09ee01501d Merge remote branch 'lmcd/master'
* lmcd/master:
  Added an optimisation for PHP-FPM (FastCGI Process Manager). As soon as a full Response is dispatched to the browser, the HTTP connection is closed, but the script stays alive on FPM servers.
2011-06-10 15:52:35 +02:00
Fabien Potencier
e92669eb47 Merge remote branch 'brikou/phpdoc_cookie'
* brikou/phpdoc_cookie:
  [HttpFoundation] added phpdoc + exception fix
2011-06-10 15:51:46 +02:00
Fabien Potencier
03a05661f9 [Form] fixed more cases where the delegating validator did not match the validator paths 2011-06-10 15:35:49 +02:00
Fabien Potencier
1daca76197 [Form] unified the way form and data path are created 2011-06-10 15:35:35 +02:00
Fabien Potencier
7de4d28a05 Merge remote branch 'yethee/delegating_validator'
* yethee/delegating_validator:
  [Form] Fixed path mapping for DelegatingValidator
2011-06-10 13:54:44 +02:00
Brikou CARRE
896c294b58 [HttpFoundation] added phpdoc + exception fix 2011-06-10 08:59:49 +02:00
Lee McDermott
7e89a6ad41 Added an optimisation for PHP-FPM (FastCGI Process Manager).
As soon as a full Response is dispatched to the browser, the HTTP connection is closed, but the script stays alive on FPM servers.
2011-06-09 19:11:02 +01:00
Eriksen Costa
c9acf2e60c [Form] minor code simplification 2011-06-09 13:24:55 -03:00
Fabien Potencier
ea93e4cafa [Form] added a circular reference safeguard for form type 2011-06-09 17:58:22 +02:00
Fabien Potencier
d044498cde [Form] changed the way default type names are created to avoid collisions 2011-06-09 16:43:02 +02:00
Albert Jessurum
ca52a04f5e [Validator] Allow DateTime objects as valid Times 2011-06-09 15:47:51 +02:00
Lukas Kahwe Smith
8ef83d548b marked public api 2011-06-09 14:51:26 +02:00
Lukas Kahwe Smith
f67b3f508e more encoder lazy loading tweaks 2011-06-09 14:51:26 +02:00
Lukas Kahwe Smith
4b3f6215b7 always use getEncoder() to enable lazy loading 2011-06-09 14:51:26 +02:00
Lukas Kahwe Smith
64c8a1ab8c cosmetic tweak 2011-06-09 14:51:25 +02:00
Lukas Kahwe Smith
c54ab34363 removed setEncoder/removeEncoder/addNormalizer/removeNormalizer 2011-06-09 14:51:25 +02:00
Lukas Kahwe Smith
8473e3e56a SerializerAwareInterface and DecoderInterface do not implement EncoderInterface anymore 2011-06-09 14:51:25 +02:00
Lukas Kahwe Smith
b9bc5f9b20 handle non objects 2011-06-09 14:51:25 +02:00
Lukas Kahwe Smith
c470d8b273 moved the methods that can later be moved to a Builder to the bottom 2011-06-09 14:51:25 +02:00
Lukas Kahwe Smith
5b3ccba2a1 use getEncoder inside encode/decode 2011-06-09 14:51:25 +02:00
Lukas Kahwe Smith
7ecd5e7590 made serialize/deserialize/encode/decode final 2011-06-09 14:50:55 +02:00
Lukas Kahwe Smith
52b8cb622d added Constructor 2011-06-09 14:50:55 +02:00
Lukas Kahwe Smith
46da5ff069 added Exception's from SerializerBundle 2011-06-09 14:50:55 +02:00
Lukas Kahwe Smith
1eecf1a5d1 made (de)normalizeObject() private 2011-06-09 14:50:55 +02:00
Lukas Kahwe Smith
054e41573e renamed hasEncoder/hasDecoder to supportsSerialization/supportsDeserialization 2011-06-09 14:50:55 +02:00
Lukas Kahwe Smith
900dda8239 notice fixes 2011-06-09 14:50:55 +02:00
Lukas Kahwe Smith
9fdfac81ec typo fixes 2011-06-09 14:50:55 +02:00
Lukas Kahwe Smith
c3acd5df54 all encoders implement EncoderInterface 2011-06-09 14:50:54 +02:00
Lukas Kahwe Smith
e694397f16 removed redundant management of encoders and decoders, aka assume all decoders are also encoders
anything else is a total edge case that doesnt break with this change. it just means that for that edge case it will not be possible to "statically" determine if the encoder doesnt actually support encoding.
2011-06-09 14:50:54 +02:00
Lukas Kahwe Smith
34b5a67987 expand interface
actually the main methods I am looking for is hasDecoder() and getEncoder() to be able to check if there is a Decoder to decode the Request body as well as if the encoder implements the TemplatingAwareInterface
2011-06-09 14:50:25 +02:00
Fabien Potencier
f3cafcb355 merged symfony/form-simplification 2011-06-09 13:29:31 +02:00
Fabien Potencier
852a4c9c6a [Form] removed the file upload temporary storage feature
The current implementation is not ready for inclusion in 2.0. It has several
known problems (security, not possible to disable it, not "cloud-compatible",
...) and it's not a must have feature anyway.

Some references:

 * Security issue in FileType: https://github.com/symfony/symfony/issues/1001
 * Validation fails on file, still stored in TemporaryStorage: https://github.com/symfony/symfony/issues/908
 * Add a size argument & ability to configure TemporaryStorage: https://github.com/symfony/symfony/pull/748

This feature should be reworked and discussed for inclusion in 2.1.
2011-06-09 12:44:36 +02:00
Fabien Potencier
1e8cd6d34d [HttpFoundation] removed the leading . for extensions 2011-06-09 12:42:42 +02:00
Fabien Potencier
2ee0c284bc [Form] fixed CS 2011-06-09 11:40:24 +02:00
Fabien Potencier
fd97dd0059 [Form] text is now the default type when not explicitely set and when no data class is set 2011-06-09 11:37:06 +02:00
Fabien Potencier
a6a3789a54 [Form] tweaked an error message 2011-06-09 11:33:25 +02:00
Fabien Potencier
d9500418cd [Form] tweaked an error message 2011-06-09 11:32:20 +02:00
Fabien Potencier
88184394b5 [Form] tweaked the error message when a form with a file upload does not have the enctype attribute correctly configured 2011-06-09 08:36:40 +02:00
Fabien Potencier
17cd08dc6c fixed CS 2011-06-08 19:56:59 +02:00
Kris Wallsmith
5ecb252ddf [Form] removed collection prototype from form tree 2011-06-08 08:34:20 -04:00
Fabien Potencier
566511e9e7 moved some FormView methods to FormUtil where they really belongs 2011-06-08 14:07:04 +02:00
Fabien Potencier
1aabc5da64 fixed CS 2011-06-08 12:16:48 +02:00
Fabien Potencier
62e4342a86 fixed CS 2011-06-08 12:12:55 +02:00
Fabien Potencier
0af4743583 [HttpFoundation] fixed Request::getFormat() when the mime-type has some optional parameter (closes #1235) 2011-06-08 11:12:57 +02:00
Fabien Potencier
f16e206cd7 [HttpFoundation] added missing CONTENT_TYPE and CONTENT_LENGTH to the Request headers (these two headers are not prefixes with HTTP_ -- as per the CGI/1.1 spec, closes #1234) 2011-06-08 11:04:41 +02:00
Fabien Potencier
188e74273a [Security] fixed sub-requests creation (closes #1212) 2011-06-08 10:36:14 +02:00
Fabien Potencier
9118fcee14 [HttpFoundation] fixed CS 2011-06-08 10:35:47 +02:00