Commit Graph

8017 Commits

Author SHA1 Message Date
Fabien Potencier
4e1499dd74 merged branch maastermedia/patch-1 (PR #3010)
Commits
-------

fae7157 slovenian validators translations correction

Discussion
----------

slovenian validators translations correction
2012-01-02 09:23:26 +01:00
Joseph Rouff
20f96bd49d Fix CS 2012-01-02 00:34:34 +01:00
Joseph Rouff
2f47ccab9c [Propel1] Add a PropelExtension
The propel extension allow to use propel specific type (ModelType) outside of
Symfony2.
2012-01-02 00:25:31 +01:00
Peter Kokot
fae715798a slovenian validators translations correction 2012-01-01 20:48:21 +01:00
Fabien Potencier
1e2d1a3406 [WebProfilerBundle] fixed some bugs 2011-12-31 16:35:58 +01:00
Fabien Potencier
66a18f3239 [BrowserKit] first attempt at fixing CookieJar (closes #2209) 2011-12-31 16:32:51 +01:00
Fabien Potencier
b46114a0f6 [WebProfilerBundle] moved the computation of the Router panel at runtime 2011-12-31 15:53:13 +01:00
Fabien Potencier
3d5ecc0478 [HttpKernel] added the path info in the request data collector 2011-12-31 15:51:33 +01:00
Fabien Potencier
e462f7b668 [Templating] simplified PhpEngine as it cannot implements the streaming interface 2011-12-31 14:50:33 +01:00
Fabien Potencier
6c6d91ed74 fixed typo 2011-12-31 10:50:19 +01:00
Fabien Potencier
716d002ef5 merged branch jmikola/MongoDbProfilerStorageTest (PR #3008)
Commits
-------

3ef0594 [HttpKernel] Fix missing $method argument in MongoDbProfilerStorageTest

Discussion
----------

[HttpKernel] Fix missing $method argument in MongoDbProfilerStorageTest

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

This test case fixes failures related to a signature change for ProfilerStorageInterface::find(). See: 1aef4e806b and 5f2226807c.

This was easily missed as the test case is skipped unless a MongoDB server is running.
2011-12-31 10:23:48 +01:00
Jeremy Mikola
3ef0594e74 [HttpKernel] Fix missing $method argument in MongoDbProfilerStorageTest
This test case fixes failures related to a signature change for ProfilerStorageInterface::find(). See: 1aef4e806b and 5f2226807c.
2011-12-31 03:10:55 -05:00
Fabien Potencier
899e252032 merged branch symfony/streaming (PR #2935)
Commits
-------

887c0e9 moved EngineInterface::stream() to a new StreamingEngineInterface to keep BC with 2.0
473741b added the possibility to change a StreamedResponse callback after its creation
8717d44 moved a test in the constructor
e44b8ba made some cosmetic changes
0038d1b [HttpFoundation] added support for streamed responses

Discussion
----------

[HttpFoundation] added support for streamed responses

To stream a Response, use the StreamedResponse class instead of the
standard Response class:

    $response = new StreamedResponse(function () {
        echo 'FOO';
    });

    $response = new StreamedResponse(function () {
        echo 'FOO';
    }, 200, array('Content-Type' => 'text/plain'));

As you can see, a StreamedResponse instance takes a PHP callback instead of
a string for the Response content. It's up to the developer to stream the
response content from the callback with standard PHP functions like echo.
You can also use flush() if needed.

From a controller, do something like this:

    $twig = $this->get('templating');

    return new StreamedResponse(function () use ($templating) {
        $templating->stream('BlogBundle:Annot:streamed.html.twig');
    }, 200, array('Content-Type' => 'text/html'));

If you are using the base controller, you can use the stream() method instead:

    return $this->stream('BlogBundle:Annot:streamed.html.twig');

You can stream an existing file by using the PHP built-in readfile() function:

    new StreamedResponse(function () use ($file) {
        readfile($file);
    }, 200, array('Content-Type' => 'image/png');

Read http://php.net/flush for more information about output buffering in PHP.

Note that you should do your best to move all expensive operations to
be "activated/evaluated/called" during template evaluation.

Templates
---------

If you are using Twig as a template engine, everything should work as
usual, even if are using template inheritance!

However, note that streaming is not supported for PHP templates. Support
is impossible by design (as the layout is rendered after the main content).

Exceptions
----------

Exceptions thrown during rendering will be rendered as usual except that
some content might have been rendered already.

Limitations
-----------

As the getContent() method always returns false for streamed Responses, some
event listeners won't work at all:

* Web debug toolbar is not available for such Responses (but the profiler works fine);
* ESI is not supported.

Also note that streamed responses cannot benefit from HTTP caching for obvious
reasons.

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

by Seldaek at 2011/12/21 06:34:13 -0800

Just an idea: what about exposing flush() to twig? Possibly in a way that it will not call it if the template is not streaming. That way you could always add a flush() after your </head> tag to make sure that goes out as fast as possible, but it wouldn't mess with non-streamed responses. Although it appears flush() doesn't affect output buffers, so I guess it doesn't need anything special.

When you say "ESI is not supported.", that means only the AppCache right? I don't see why this would affect Varnish, but then again as far as I know Varnish will buffer if ESI is used so the benefit of streaming there is non-existent.

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

by cordoval at 2011/12/21 08:04:21 -0800

wonder what the use case is for streaming a response, very interesting.

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

by johnkary at 2011/12/21 08:19:48 -0800

@cordoval Common use cases are present fairly well by this RailsCast video: http://railscasts.com/episodes/266-http-streaming

Essentially it allows faster fetching of web assets (JS, CSS, etc) located in the &lt;head>&lt;/head>, allowing those assets to be fetched as soon as possible before the remainder of the content body is computed and sent to the browser. The end goal is to improve page load speed.

There are other uses cases too like making large body content available quickly to the service consuming it. Think if you were monitoring a live feed of JSON data of newest Twitter comments.

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

by lsmith77 at 2011/12/21 08:54:35 -0800

How does this relate the limitations mentioned in:
http://yehudakatz.com/2010/09/07/automatic-flushing-the-rails-3-1-plan/

Am I right to understand that due to how twig works we are not really streaming the content pieces when we call render(), but instead the entire template with its layout is rendered and only then will we flush? or does it mean that the render call will work its way to the top level layout template and form then on it can send the content until it hits another block, which it then first renders before it continues to send the data?

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

by stof at 2011/12/21 09:02:53 -0800

@lsmith77 this is why the ``stream`` method calls ``display`` in Twig instead of ``render``. ``display`` uses echo to print the output of the template line by line (and blocks are simply method calls in the middle). Look at your compiled templates to see it (the ``doDisplay`` method)
Rendering a template with Twig simply use an output buffer around the rendering.

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

by fabpot at 2011/12/21 09:24:33 -0800

@lsmith77: We don't have the Rails problem thanks to Twig as the order of execution is the right one by default (the layout is executed first); it means that we can have the flush feature without any change to how the core works. As @stof mentioned, we are using `display`, not `render`, so we are streaming your templates for byte one.

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

by fabpot at 2011/12/21 09:36:41 -0800

@Seldaek: yes, I meant ESI with the PHP reverse proxy.

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

by fabpot at 2011/12/21 09:37:34 -0800

@Seldaek: I have `flush()` support for Twig on my todo-list. As you mentioned, It should be trivial to implement.

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

by fzaninotto at 2011/12/21 09:48:18 -0800

How do streaming responses deal with assets that must be called in the head, but are declared in the body?

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

by fabpot at 2011/12/21 09:52:12 -0800

@fzaninotto: What do you mean?

With Twig, your layout is defined with blocks ("holes"). These blocks are overridden by child templates, but evaluated as they are encountered in the layout. So, everything works as expected.

As noted in the commit message, this does not work with PHP templates for the problems mentioned in the Rails post (as the order of execution is not the right one -- the child template is first evaluated and then the layout).

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

by fzaninotto at 2011/12/21 10:07:35 -0800

I was referring to using Assetic. Not sure if this compiles to Twig the same way as javascript and stylesheet blocks placed in the head - and therefore executed in the right way.

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

by fabpot at 2011/12/21 10:34:59 -0800

@Seldaek: I've just added a `flush` tag in Twig 1.5: 1d6dfad4f5

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

by catchamonkey at 2011/12/21 13:29:22 -0800

I'm really happy you've got this into the core, it's a great feature to have! Good work.
2011-12-31 08:12:02 +01:00
Fabien Potencier
887c0e9c04 moved EngineInterface::stream() to a new StreamingEngineInterface to keep BC with 2.0 2011-12-31 08:11:20 +01:00
Henrik Bjørnskov
c37c14528e [SecurityBundle] Only throw exception if check_path looks like an url 2011-12-30 20:00:08 +01:00
Fabien Potencier
d12f5b202c [Routing] removed trailing slash support for routes that are not available for GET/HEAD methods (as the redirection will always occurs with a GET/HEAD request, closes #2626) 2011-12-30 19:30:23 +01:00
Fabien Potencier
7b00662df3 [Routing] fixed wrong namespaces in tests 2011-12-30 19:13:17 +01:00
Fabien Potencier
eef8a3c513 [FrameworkBundle] changed the implementation of Controller::getUser() to be similar to the one from GlobalVariables::getUser() 2011-12-30 16:15:28 +01:00
Fabien Potencier
a78437bba9 Revert "merged branch kriswallsmith/security/demeter-fix (PR #2816)"
This reverts commit 76ba2bc7ac, reversing
changes made to 4730f4303b.
2011-12-30 16:05:26 +01:00
Fabien Potencier
466a8b8f48 Merge branch '2.0'
* 2.0:
  [Tests] Skip segfaulting form test
  Rename test file
  [BrowserKit] added missing @return PHPDoc for the Client::submit() method.
  also test PHP 5.3.2, since this is the official lowest supported PHP version
2011-12-30 15:44:05 +01:00
Fabien Potencier
362d31d002 merged branch stloyd/skip_test (PR #3004)
Commits
-------

4c44023 [Tests] Skip segfaulting form test

Discussion
----------

[Tests] Skip segfaulting form test when using PHP <= 5.3.2

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

http://travis-ci.org/#!/stloyd/symfony/jobs/461563
2011-12-30 15:43:40 +01:00
Joseph Bielawski
4c44023e8b [Tests] Skip segfaulting form test 2011-12-30 15:36:55 +01:00
Fabien Potencier
8c4af20482 merged branch lsmith77/travis_test_5_3_2 (PR #2958)
Commits
-------

dfbed9f also test PHP 5.3.2, since this is the official lowest supported PHP version

Discussion
----------

[WIP] test with PHP 5.3.2 on travis

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: ![Build Status](https://secure.travis-ci.org/lsmith77/symfony.png?branch=travis_test_5_3_2)
Fixes the following tickets: -

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

by lsmith77 at 2011/12/25 16:29:20 -0800

Enable testing against PHP 5.3.2, not sure why its segfaulting PHPUnit. Will check with @loicfrering whats going on there.

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

by lsmith77 at 2011/12/25 17:31:04 -0800

the issue may be inside the ClassLoader .. so we might need to increase the minimal version. but this needs to be confirmed independently.
2011-12-30 14:08:00 +01:00
Fabien Potencier
094b326bf2 merged branch hhamon/browser_kit_phpdoc (PR #2991)
Commits
-------

885fa02 [BrowserKit] added missing @return PHPDoc for the Client::submit() method.

Discussion
----------

[BrowserKit] added missing @return PHPDoc for the Client::submit() method
2011-12-30 14:07:36 +01:00
Fabien Potencier
b150fe1fdd merged branch odolbeau/2.0 (PR #2993)
Commits
-------

0d3e709 Rename test file

Discussion
----------

Just rename MessageCatalogTest in MessageCatalogueTest

This time, in the correct branch...

(see: https://github.com/symfony/symfony/pull/2987)
2011-12-30 14:02:35 +01:00
Fabien Potencier
5530902607 merged branch inanimatt/patch-1 (PR #2994)
Commits
-------

7e48f97 Fix speling misteak :)

Discussion
----------

Fix speling misteak :)

Just a little one, but it's in a subtitle.

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

by hhamon at 2011/12/29 08:45:42 -0800

Misteak ? ^^ You misspelled your commit message :)

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

by inanimatt at 2011/12/29 08:48:56 -0800

That was a joke :P
2011-12-30 14:02:22 +01:00
Fabien Potencier
5d4d8ef318 merged branch alefranz/patch-1 (PR #2997)
Commits
-------

de9d7d8 Updated italian traslation of validator

Discussion
----------

Updated italian traslation of validator
2011-12-30 14:01:31 +01:00
alefranz
de9d7d8c3c Updated italian traslation of validator 2011-12-29 20:56:01 +01:00
Anton Babenko
1cd74ec2cd Added norwegian translations of validators 2011-12-29 18:21:01 +01:00
Matt Robinson
7e48f97a89 Fix speling misteak :) 2011-12-29 17:29:56 +01:00
Olivier Dolbeau
0d3e709e0e Rename test file 2011-12-29 16:30:31 +01:00
Hugo Hamon
885fa02871 [BrowserKit] added missing @return PHPDoc for the Client::submit() method. 2011-12-29 15:00:40 +01:00
Fabien Potencier
23e04e3acb merged 2.0 2011-12-29 09:22:11 +01:00
Fabien Potencier
5106810803 merged branch Burgov/reverse_transform_test_fix_2_0 (PR #2984)
Commits
-------

ced57d8 reverse transform doesn't take a second argument

Discussion
----------

reverse transform doesn't take a second argument

as requested in https://github.com/symfony/symfony/pull/2980

when cherry-picking the earlier commit I found out that some assertSame calls had been changed into assertNull in 2.1, but not in 2.0. This will probably result in some merge problems later. Let me know if and how I should update my commit if this is the case
2011-12-29 09:19:10 +01:00
Bart van den Burg
ced57d8ee5 reverse transform doesn't take a second argument 2011-12-29 09:10:04 +01:00
Fabien Potencier
a01eee8536 merged branch ericclemmons/2884-parameterbag-with-spaces (PR #2976)
Commits
-------

85ca8e3 ParameterBag no longer resolves parameters that have spaces.
99011ca Added tests for ParameterBag parameters with spaces

Discussion
----------

[DependencyInjection] Parameters with spaces are not resolved

Bug fix: yes
Feature addition: no
Backwards compatibility break: no (not likely, according to convention)
Symfony2 tests pass: yes
Fixes the following tickets: #2884

`ParameterBag` currently resolves anything between two `%` signs, which creates issues for any parameters in the DIC that are legitimate text.  This PR enforces the [documented parameter convention](http://symfony.com/doc/2.0/book/service_container.html#service-parameters) so that only `%parameters.with.no_spaces%` are resolved.

I was considering using instead `^%([^\w\._-]+)%$`, but felt that was too constricting & could easily introduce issues with existing applications.
2011-12-28 21:36:04 +01:00
Fabien Potencier
cab70f4083 merged 2.0 2011-12-28 20:44:29 +01:00
Fabien Potencier
48203fc1a2 merged branch havvg/patch-1 (PR #2957)
Commits
-------

41950a6 [WebProfilerBundle] add margin-bottom to caption

Discussion
----------

[WebProfilerBundle] add margin-bottom to caption

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

by fabpot at 2011/12/26 13:15:57 -0800

What does it fix?

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

by havvg at 2011/12/27 02:46:16 -0800

Just a minor design issue with table captions.

Without: http://dl.dropbox.com/u/548684/PR2957/without-margin.png
With: http://dl.dropbox.com/u/548684/PR2957/with-margin.png

I currently hold it in a custom css, but thought it is generic enough to be put into the bundle.

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

by henrikbjorn at 2011/12/27 04:03:53 -0800

@havvg What custom bundle is that ? and what does it show? look interesting

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

by havvg at 2011/12/27 04:40:18 -0800

@henrikbjorn It's a bundle (not published yet, https://github.com/havvg/HavvgCloudcontrolBundle) adding features to fully utilize applications on http://cloudcontrol.com PaaS.
2011-12-28 20:42:42 +01:00
Fabien Potencier
e6c6b46ae9 merged branch aerialls/check_cs_fix (PR #2975)
Commits
-------

0797564 [Check CS] don't replace 'else if' on twig files (closes #2961)

Discussion
----------

[Check CS] don't replace 'else if' on twig files (closes #2961)
2011-12-28 20:40:59 +01:00
Fabien Potencier
6c96ccef4f merged branch javiereguiluz/phpdoc-console-component (PR #2978)
Commits
-------

3f2e1b0 [Console] Updated tests to reflect the change from `program` to `application`
2b64944 [Console][Output] Fixed some minor typos and grammatical errors
96997f1 [Console][Input] Added missing PHPDoc and fixed some minor typos and grammatical errors
855b8af [Console][Helper] Added missing PHPDoc and fixed some minor typos and grammatical errors
3ad02bd [Console][Formatter] Added missing PHPDoc @throws and fixed some minor typos and grammatical errors
33e3f11 [Console] Added a missing PHPDoc and replaced `program` by `application`

Discussion
----------

[Console] Fixed and completed PHPDoc

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

Fixes the following tickets: -

* Fixed minor typos and grammatical errors
* Added missing PHPDoc for some methods
* Added missing @throws
2011-12-28 20:38:46 +01:00
Fabien Potencier
15d72733ef merged branch mshtukin/master (PR #2979)
Commits
-------

1bc10e5 Forgotten </trans-unit> tag added

Discussion
----------

Forgotten </trans-unit> tag added

on src/Symfony/Bundle/FrameworkBundle/Resources/translations/validators.es.xlf
2011-12-28 20:38:29 +01:00
Fabien Potencier
1a7349bd87 merged branch loalf/patch-1 (PR #2981)
Commits
-------

60f845f 'for' was duplicated

Discussion
----------

'for' was duplicated
2011-12-28 20:37:47 +01:00
Javier López
60f845f518 'for' was duplicated 2011-12-28 16:35:20 +00:00
Michael
1bc10e5375 Forgotten </trans-unit> tag added 2011-12-28 14:15:50 +02:00
Javier Eguíluz
3f2e1b0483 [Console] Updated tests to reflect the change from program to application 2011-12-28 12:44:00 +01:00
Javier Eguíluz
2b64944fd7 [Console][Output] Fixed some minor typos and grammatical errors 2011-12-28 10:42:15 +01:00
Javier Eguíluz
96997f12d6 [Console][Input] Added missing PHPDoc and fixed some minor typos and grammatical errors 2011-12-28 10:39:14 +01:00
Javier Eguíluz
855b8af776 [Console][Helper] Added missing PHPDoc and fixed some minor typos and grammatical errors 2011-12-28 10:33:49 +01:00
Javier Eguíluz
3ad02bd5f9 [Console][Formatter] Added missing PHPDoc @throws and fixed some minor typos and grammatical errors 2011-12-28 10:29:22 +01:00
Javier Eguíluz
33e3f11f48 [Console] Added a missing PHPDoc and replaced program by application 2011-12-28 10:22:28 +01:00