Commit Graph

597 Commits

Author SHA1 Message Date
Fabien Potencier
3719c70870 updated minimum PHP version to 5.3.3
5.3.3 has some interesting fixes and this is the version used by
Redhat 6 and Debian 6
2012-05-07 10:29:11 +02:00
Fabien Potencier
9fbf8555f0 Revert "merged branch Seldaek/master (PR #4133)"
This reverts commit 00e7a94a8c, reversing
changes made to a01dec00f4.
2012-04-27 19:55:40 +02:00
Jordi Boggiano
00c4267726 Update branch aliases 2012-04-27 12:47:50 +02:00
Fabien Potencier
5f50b944ee [TwigBundle] added CHANGELOG 2012-04-26 22:53:20 +02:00
Fabien Potencier
1e84f1eef1 [TwigBundle] implemented context auto-escaping in Twig templates based on the template extension 2012-04-25 12:25:06 +02:00
Fabien Potencier
14b3b05866 [TwigBundle] added missing entry in the XSD schema 2012-04-20 16:29:04 +02:00
Fabien Potencier
580c8fa875 fixed CS 2012-04-18 10:41:11 +02:00
Joseph Bielawski
bfc1aafff6 [Tests] Use proper assertions 2012-04-14 10:05:05 +02:00
Hugo Hamon
b4f0a04574 [TwigBundle] fixed twig:lint command description. 2012-04-11 08:58:25 +02:00
Fabien Potencier
d6948581ac [TwigBundle] simplified code 2012-04-08 12:56:21 +02:00
Fabien Potencier
a11ec3e71c [TwigBundle] added correct file name in twig:lint exception reporting 2012-04-08 12:53:40 +02:00
Fabien Potencier
57c6aaa397 [TwigBundle] tweaked previous merge 2012-04-08 12:41:50 +02:00
marc.weistroff
8726ade310 Adds more features to twig:lint command 2012-04-08 11:14:51 +02:00
marc.weistroff
1d7e9d9753 Adds a linter command for templates 2012-04-07 13:26:03 +02:00
Christophe Coevoet
dbab7e1ef6 [TwigBridge] Added a TwigEngine in the bridge
This TwigEngine implements the interface available in the component.
the TwigBridge in TwigBundle now extends this class and provides only
the additional methods for the FrameworkBundle interface.
2012-04-02 18:28:35 +02:00
Eriksen Costa
013f998bb8 updated license blocks 2012-03-31 18:00:32 -03:00
Anthon Pang
33382cd4f4 Add exception-controller attribute to xsd 2012-03-26 13:17:28 -03:00
Fabien Potencier
e28223773c merged branch lencioni/improve-exception-controller-documentation (PR #3669)
Commits
-------

1422133 [TwigBundle] Made docblock for findTemplate() more general and accurate
5910ac9 [TwigBundle] Added a use statement to shorten class name in a docblock
3e7eebd [TwigBundle] Improved ExceptionController docblocks

Discussion
----------

[TwigBundle] Improved ExceptionController docblocks

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

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

by lencioni at 2012-03-21T20:47:16Z

I obviously don't know what I'm doing here. :/

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

by vicb at 2012-03-21T20:47:39Z

no pb just rebase on master and force push
2012-03-23 13:08:26 +01:00
Fabien Potencier
def4323dc8 fixed CS 2012-03-23 12:47:42 +01:00
Fabien Potencier
54ce7c75e8 merged 2.0 2012-03-22 20:34:27 +01:00
Joe Lencioni
1422133ad0 [TwigBundle] Made docblock for findTemplate() more general and accurate
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lencioni/symfony.png)](http://travis-ci.org/lencioni/symfony)
Fixes the following tickets: -
Todo: -
2012-03-22 07:58:46 -05:00
Joe Lencioni
5910ac91d7 [TwigBundle] Added a use statement to shorten class name in a docblock
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lencioni/symfony.png)](http://travis-ci.org/lencioni/symfony)
Fixes the following tickets: -
Todo: -
2012-03-21 16:57:29 -05:00
Joe Lencioni
3e7eebd91f [TwigBundle] Improved ExceptionController docblocks
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lencioni/symfony.png)](http://travis-ci.org/lencioni/symfony)
Fixes the following tickets: -
Todo: -
2012-03-21 15:50:32 -05:00
Joe Lencioni
068e859f3d [TwigBundle] Changed getAndCleanOutputBuffering() handling of systems where ob_get_level() never returns 0
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lencioni/symfony.png)](http://travis-ci.org/lencioni/symfony)
Fixes the following tickets: -
Todo: -

Relying on decrementing a counter has two problems. First, and most importantly, if the output buffering nesting level is greater than the counter, the function does not perform the expected task. Secondly, on systems where the counter is needed, a lot of unnecessary extra loops would potentially occur.

This approach checks to see if the level has stayed the same from the previous iteration and if it has it stops looping.
2012-03-21 15:25:48 -05:00
Joseph Bielawski
6ad201f5ba [FrameworkBundle + WebProfilerBundle] Optimized images and icons with PunnyPNG 2012-03-14 23:31:48 +01:00
Victor Berchet
eee5065434 [TwigBundle] Workaround a flaw in the design of the configuration (normalization) 2012-03-09 21:13:44 +01:00
Jordi Boggiano
bafcaafbe6 Removed version field 2012-02-27 09:59:20 +01:00
Jordi Boggiano
f9d9dc7ce9 Add branch-alias for composer 2012-02-25 03:26:20 +01:00
Victor Berchet
4feba09aa9 [Config] implements feedback 2012-02-20 19:15:01 +01:00
Victor Berchet
675e5eb6e0 [Config] Take advantage of the new PrototypedArrayNode API in the core bundles 2012-02-20 11:20:39 +01:00
Victor Berchet
0a176ebc98 [FrameworkBundle] Fix configuration errors 2012-02-15 14:38:38 +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
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
f98f9ae8ff [HttpFoundation] Refactor for DRY code.
Rename ArraySessionStorage to make it clear the session is a mock for testing purposes only.
Has BC class for ArraySessionStorage
Added sanity check when starting the session.
Fixed typos and incorrect php extension test method
session_module_name() also sets session.save_handler, so must use extension_loaded() to check if module exist
or not.
Respect autostart settings.
2012-02-11 11:24:11 +05:45
kbond
58939f16f3 [TwigBundle] added configuration docs 2012-02-02 08:20:37 -05:00
Andreas Streichardt
b1777865f5 Make twig optimizations configurable 2012-01-24 18:20:00 +01:00
lsmith77
3a1699a420 handle disaled csrf protection in the Twig FormExtension 2012-01-23 18:05:48 +01:00
Fabien Potencier
8358cbf7a6 merged branch kriswallsmith/csrf-token-helper (PR #3080)
Commits
-------

753c067 [FrameworkBundle] added $view['form']->csrfToken() helper
e1aced8 [Twig] added {{ csrf_token() }} helper

Discussion
----------

[Twig] [FrameworkBundle] added CSRF token helper

I've added a templating helper and Twig function for generating a CSRF token without the overhead of creating a form.

```html+jinja
<form action="{{ path('user_delete', { 'id': user.id }) }}" method="post">
    <input type="hidden" name="_method" value="delete">
    <input type="hidden" name="_token" value="{{ csrf_token('delete_user_' ~ user.id) }}">
    <button type="submit">delete</button>
</form>
```

```php
<?php

class UserController extends Controller
{
    public function delete(User $user, Request $request)
    {
        $csrfProvider = $this->get('form.csrf_provider');
        if (!$csrfProvider->isCsrfTokenValid('delete_user_'.$user->getId(), $request->request->get('_token')) {
            throw new RuntimeException('CSRF attack detected.');
        }

        // etc...
    }
}
```

The test that is failing on Travis appears to be unrelated, but I may be wrong?

```
1) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testLoginLogoutProcedure with data set #1 ('de')
RuntimeException: OUTPUT:
Catchable fatal error: Argument 3 passed to Symfony\Bundle\FrameworkBundle\Controller\TraceableControllerResolver::__construct() must be an instance of Symfony\Component\HttpKernel\Debug\Stopwatch, instance of Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser given, called in /tmp/2.1.0-DEV/StandardFormLogin/cache/securitybundletest/appSecuritybundletestDebugProjectContainer.php on line 94 and defined in /home/vagrant/builds/kriswallsmith/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/TraceableControllerResolver.php on line 37
```

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

by pablodip at 2012-01-10T14:18:45Z

As you don't need forms to use the csrf provider, how about putting its service without the form prefix? It could even make sense to put the CsrfProvider as a component since you can use it standalone and in more cases than only forms. It would be a small component though.

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

by Tobion at 2012-01-10T17:54:14Z

I think it would be more clear to generate the token in the controller. Doing so in the template will spread the CSRF intention across template and controller. So I don't think this extension is necessary.

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

by kriswallsmith at 2012-01-10T17:58:14Z

@pablodip I'm open to the idea of a Csrf component. This would be a good place for some nonce classes as well.

@Tobion I disagree. One use case is for a list of users, each with a delete form. Iterating over the users in the controller and generating a token for each, just to iterate over them again in the view is a waste and adds complexity.

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

by Tobion at 2012-01-10T18:05:14Z

I see. But I don't understand why the intention needs to be different for each user to delete. Usually the intention is the same for each form type. I thought this is enough.

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

by kriswallsmith at 2012-01-10T18:06:13Z

Yes, a static intention would suffice.

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

by Tobion at 2012-01-10T18:07:08Z

Then your use case is not valid anymore.

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

by Tobion at 2012-01-10T18:12:25Z

I would suggest to make a cookbook article out of it about how to create a simple form without the form component.
And include such things as validating the result using the validator component and checking the CSRF.

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

by kriswallsmith at 2012-01-10T21:32:50Z

This helper makes it easier to use CSRF protection without a form and we should make it as easy as possible. Spreading the intention across controller and template is not concerning to me. Either way, a cookbook entry is a great idea.

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

by Tobion at 2012-01-10T21:47:12Z

Well, it's just one line more without this helper. So I disagree it makes it really easier when you know how to use the CsrfProvider which is a pre-condition anyway since you must still validate its correctness by hand.

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

by kriswallsmith at 2012-01-13T13:24:15Z

Another use case is when rendering a page with a bunch of simple buttons with different intentions: delete user, delete comment, follow, unfollow... Creating all of these in the controller just leads to spaghetti.

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

by jwage at 2012-01-17T21:55:53Z

👍 lots of use cases for something like this @OpenSky
2012-01-22 10:31:29 +01:00
Fabien Potencier
5fa0f2d92b merged 2.0 2012-01-16 07:44:08 +01:00
Henrik Bjørnskov
348a3c61af [TwigBridge] Use reflection to get guess the file path for form resources fixes #3093 2012-01-12 12:23:44 +01:00
Kris Wallsmith
fe62401907 optimized string starts with checks
Doing this with strpos() is slightly faster than substr().
2012-01-11 11:33:56 -08:00
Fabien Potencier
fa1c946140 fixed some phpdoc 2012-01-11 15:52:51 +01:00
Kris Wallsmith
e1aced89fd [Twig] added {{ csrf_token() }} helper 2012-01-10 05:16:32 -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
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
887c0e9c04 moved EngineInterface::stream() to a new StreamingEngineInterface to keep BC with 2.0 2011-12-31 08:11:20 +01:00
Fabien Potencier
0038d1bac4 [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.
2011-12-21 14:34:26 +01:00
Fabien Potencier
e6e78f6a81 [TwigBundle] added Twig Debug extension support 2011-12-18 20:55:28 +01:00
Fabien Potencier
7b619e7b32 added nl2br use as it is now part of Twig core 2011-12-18 12:39:28 +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
alexandresalome
f3e92c4cc1 [TwigBundle] Fix the exception message escaping 2011-12-14 00:31:21 +01:00
Fabien Potencier
142cef21bb merged 2.0 2011-12-13 16:12:53 +01:00
Kevin Bond
73ac77336b [Config] added ability to set info message and example to node definition 2011-12-13 06:04:53 -05:00
Fabien Potencier
e3421a0b1d [DoctrineBridge] fixed some CS 2011-12-13 10:22:12 +01:00
Jonathan Ingram
7827f72cf4 Fixes #2817: ensure that the base loader is correctly initialised 2011-12-13 08:44:35 +11:00
Jordi Boggiano
1aea0733c4 Adjust composer files to strictly require known to work packages 2011-12-08 15:17:20 +01:00
Jordi Boggiano
628cce17e4 Adjust composer files to strictly require known to work packages 2011-11-25 15:15:14 +01:00
Fabien Potencier
2b5d4b90d8 merged 2.0 2011-11-24 07:16:52 +01:00
Fabien Potencier
5878490b16 removed unused use statements 2011-11-24 07:16:14 +01: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
d1ae6c7cb6 bumped Symfony version in composer.json files to 2.0.7 2011-11-17 06:58:47 +01:00
Fabien Potencier
1340ea67a6 Merge branch '2.0'
* 2.0:
  [HttpKernel] fixed Content-Length header when using ESI tags (closes #2623)
  [HttpFoundation] added an exception to MimeTypeGuesser::guess() when no guesser are available (closes #2636)
  [Security] fixed HttpUtils::checkRequestPath() to not catch all exceptions (closes #2637)
  [DoctrineBundle] added missing default parameters, needed to setup and use DBAL without ORM
  [Transation] Fix grammar.
  [TwigBundle] Fix trace to not show 'in at line' when file/line are empty.
2011-11-14 14:32:22 +01:00
Danny Berger
4858fbe7e0 [TwigBundle] Fix trace to not show 'in at line' when file/line are empty. 2011-11-11 18:20:32 -06:00
Fabien Potencier
83b24c5e5b Merge branch '2.0'
* 2.0:
  changed the way we store the current ob level (refs #2617)
2011-11-11 23:36:46 +01:00
Fabien Potencier
bb5fb79c3d changed the way we store the current ob level (refs #2617) 2011-11-11 23:35:49 +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
Igor Wiedler
29e12affb0 [TwigBundle] Extract output buffer cleaning to method 2011-11-11 14:54:44 +01:00
Igor Wiedler
ed1a6c2e45 [TwigBundle] Do not clean output buffering below initial level
This resulted in issues with PHPUnit 3.6, which will buffer all output and clean them in the end. Since
we cleaned their buffer, the subsequent clean would raise a warning. This is documented in issue 390 of
the PHPUnit tracker.

Closes #2531.
2011-11-11 12:09:57 +01:00
Fabien Potencier
0025673d15 Merge branch '2.0'
* 2.0:
  Added a class to the logs ol element to prevent hiding it when toggling an exception (fixes #2589).
  Remove only the security token instead of the session cookie.
  Clear session cookie if user was deleted, is disabled or locked to prevent infinite redirect loops to the login path (fixes #1798).
2011-11-10 10:55:16 +01:00
H. Westphal
932c144534 Added a class to the logs ol element to prevent hiding it when toggling an exception (fixes #2589). 2011-11-10 10:20:28 +01:00
Fabien Potencier
ae154c8ecd [TwigBundle] fixed exception class name 2011-11-07 21:15:36 +01:00
Fabien Potencier
47b888a957 added the real template name when an error occurs in a Twig template 2011-11-07 20:48:18 +01:00
Fabien Potencier
b957515a17 [TwigBundle] fixed inheritance in TimedTwigEngine 2011-11-07 19:12:33 +01:00
Fabien Potencier
f8f622b39c bumped Symfony version to 2.0.6-DEV 2011-11-02 14:18:45 +01:00
Fabien Potencier
7f21a5e979 bumped Symfony version in composer.json files to 2.0.5 2011-11-02 12:42:41 +01:00
Fabien Potencier
fd380e37a9 merged 2.0 2011-11-01 20:19:25 +01:00
Fabien Potencier
fc97472f64 updated composer.json files to contain information about autoloading and target dirs 2011-11-01 20:17:57 +01:00
Fabien Potencier
dec43f5539 merged 2.0 2011-10-29 12:01:39 +02:00
Fabien Potencier
851eb73778 removed unused use statements 2011-10-29 11:56:30 +02:00
Fabien Potencier
842ac36f33 added Stopwatch support in debug mode, added a timeline representing the stopwatch events in the web profiler
Enjoy!
2011-10-21 07:45:12 +02:00
Fabien Potencier
f1e9709742 updated composer.json files 2011-10-16 03:38:02 +02:00
Fabien Potencier
ae8efc4da9 merged 2.0 2011-10-16 03:34:55 +02:00
Igor Wiedler
03bdac04ae [composer] make twig-bundle require twig-bridge 2011-10-15 16:56:13 +02:00
Igor Wiedler
575771380b [composer] add doctrine and twig dependencies 2011-10-15 16:55:54 +02:00
Fabien Potencier
beda03ba96 updated all HttpKernel event listeners to implement EventSubscriberInterface 2011-10-10 14:54:49 +02:00
Fabien Potencier
245ff6d7a8 updated composer.json for 2.1 2011-09-29 17:40:43 +02:00
Fabien Potencier
f5ab6ec934 Merge branch '2.0'
* 2.0:
  [composer] add missing deps for FrameworkBundle
  [composer] change ext/intl to the new ext-intl syntax
  [composer] fix monolog-bridge composer.json, add more inter-component deps
  [composer] add composer.json
2011-09-29 17:29:32 +02:00
Igor Wiedler
9ade639bb4 [composer] add composer.json 2011-09-27 00:55:43 +02:00
Michel Salib
ef322f680d -- add command that extracts translation messages from templates
-- add missing files

-- tweak translation command files

-- dumpers are now responsive for writting the files

-- moved the twig extractor the bridge

-- clear temp files after unit tests
-- check the presence of dumper in translation writer

-- General cleaning of the code

-- clean phpDoc

-- fix PHPDoc

-- fixing class name in configuration

-- add unit tests for extractors (php and twig)

-- moved test to correct location

-- polish the code

-- polish the code
2011-09-09 10:23:54 +02:00
Fabien Potencier
5d9bd6da4f [TwigBundle] fixed XSS in the exception template 2011-07-22 13:42:59 +02:00
Fabien Potencier
3749ad43f4 moved the Exception listener from FrameworkBundle to TwigBundle as it relies on Twig being enabled
This commit also fixes exception pages when Twig is not enabled as a templating engine.
Instead of just displaying the raw Twig template as before, we now fallback to the default
exception handler introduced some time ago.
2011-07-21 19:24:04 +02:00
Fabien Potencier
c3a060e368 updated all core extensions to use the new shortcut method 2011-07-18 17:46:00 +02:00
Victor Berchet
39d9a8ad6e [TwigBundle] Fix configuration 2011-06-22 08:55:52 +02:00
Fabien Potencier
8c89da0004 [TwigBundle] fixed cache warmer when there is a template with a syntax error 2011-06-17 15:03:38 +02:00
Fabien Potencier
e24dce2ae7 merged branch stloyd/tests (PR #1318)
Commits
-------

edf4b87 Add missing "tearDown" functions, and some missing variable declaration (this saves for me almost 20MB when run all tests) Force AsseticBundle tests to use TestCase Fix test for DoctrineBundle to use TestCase
2b0c352 Increase code coverage for: YamlParser, Validators, PhpEngine + Helpers, HttpFoundation
b88a0a0 Remove tabs
99f9337 Additional tests for PhpEngine + Helpers More tests for UrlValidator
450ed85 Additional tests for DateTimeValidator, EmailValidator and UrlValidator

Discussion
----------

[Tests] Cleanup + make code coverage more happy

Hey,

this PR is a bit bigger than usually ;-) few infos what's inside:

- Fix `DoctrineBundle` test to use `TestCase`
- Mark tests as "incomplete" instead of commenting them out
- Increase code coverage for: `Validators`, `PhpEngine` + `Helpers`, `HttpFoundation` (`Session`, `Response` etc.)
- And my favourite ;-) added missing variables definition (also removed non-used) and `tearDown()` function (if needed) to tests which allowed me saved __~15MB__ when running all tests

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

by stloyd at 2011/06/16 05:58:21 -0700

@fabpot & @marcw It was rebased and cleanup up (I split up `AsseticBundle` symfony/AsseticBundle#1 change to new repo), and added few new tests.
2011-06-16 15:21:15 +02:00
Fabien Potencier
a7974ff43c renamed Form Twig templates to be more explicit 2011-06-16 15:20:12 +02:00
stloyd
edf4b87dcb Add missing "tearDown" functions, and some missing variable declaration (this saves for me almost 20MB when run all tests)
Force AsseticBundle tests to use TestCase
Fix test for DoctrineBundle to use TestCase
2011-06-16 15:06:36 +02:00
Victor Berchet
acd2cf11d8 [TwigBundle] Optimize the FilesystemLoader 2011-06-12 14:49:18 +02:00
Fabien Potencier
ca013311bd [TwigBundle] fixed XSD 2011-06-11 08:00:55 +02:00
Fabien Potencier
355f802546 [TwigBundle] fixed tests 2011-06-11 07:54:10 +02:00
Fabien Potencier
96045739b1 [TwigBundle] removed the extensions setting 2011-06-11 07:50:14 +02:00
Fabien Potencier
89f544afb6 moved Twig form templates to the Twig bridge 2011-06-07 16:38:23 +02:00
Fabien Potencier
6737bd36bd [TwigBundle] made table_layout.html.twig useable as a trait 2011-06-07 13:52:58 +02:00
Fabien Potencier
96fc666454 simplified cache warmers
Here are the new simplified rules:

 * Required cache warmers are *always* executed when the Kernel boots for the first time;
 * Optional cache warmers are *only* executed from the CLI via cache:warmup

These new rules means that all the configuration settings for the cache
warmers have been removed. So, if you want the best performance, remember to
warmup the cache when going to production.

This also fixed quite a few bugs.
2011-06-07 11:42:27 +02:00
Fabien Potencier
5be0bafe7f removed TemplateReferenceInterface::getSignature() (replaced by the existing getLogicalName() which already acts as a unique identifier) 2011-06-07 10:12:38 +02:00
Fabien Potencier
5af7c7fffd moved TemplateFinder to CacheWarmer as it is only useful in this context 2011-06-07 09:39:41 +02:00
Victor Berchet
ef8cb967f5 Merge branch 'master' into form-collection-rendering 2011-06-06 14:39:18 +02:00
Victor Berchet
bca17fe6a3 [Form] Fix collection rendering 2011-06-06 14:21:49 +02:00
Victor Berchet
6711a184fd [TwigBundle][Form] Simplify templates
The Repeated and Collection types extend the Form type so there is no need to explicitely render the parent section.
2011-06-06 12:53:19 +02:00
Victor Berchet
181fb56925 [Form][Twig] Reorganized the form template 2011-06-06 12:32:08 +02:00
stloyd
cb22ccc516 [Form] Added missing feature for adding attributes to an field label 2011-05-31 17:01:28 +02:00
Fabien Potencier
65200aa86a added missing license headers 2011-05-31 10:57:06 +02:00
Pascal Borreli
824e48efa7 [Various] Fixed phpdoc 2011-05-29 23:33:36 +00:00
Miha Vrhovnik
b8144c62ad DateType single-text should be single_text 2011-05-27 16:23:59 +02:00
Fabien Potencier
923c234160 fixed form_rest() for embedded forms (refs #1051, #1115) 2011-05-27 08:12:39 +02:00
Kris Wallsmith
4018040bbb [TwigBundle] reverted to lazy-loading of templating helpers (fixes #1066) 2011-05-24 09:09:47 -07:00
alexandresalome
b1a26b8829 [TwigBundle] Remove authoring 2011-05-24 10:56:45 +02:00
alexandresalome
98755bc8a5 [TwigBundle] Remove use ContainerInterface - not used 2011-05-24 10:56:45 +02:00
alexandresalome
dfdd26d6c4 [TwigBundle] Move all class names to parameters of DIC 2011-05-24 10:56:45 +02:00
alexandresalome
f13798fa5e [TwigBundle] Rename TemplatingExtension to AssetsExtension
This extension now only contains assets functions
2011-05-24 10:56:45 +02:00
alexandresalome
f83c1376a1 [TwigBundle] Move the code filters to a dedicated extensions
A dedicated extension now exists for the code-related filters for Twig.
The dependency to service_container was also removed, to use CodeHelper, instead
2011-05-24 10:56:45 +02:00
alexandresalome
73bd9c72af [TwigBundle] Change the dependency of ActionsExtension to the actions helper
The logical of moving $attributes to a value of $options is already present
in the PHP templating helper.
2011-05-24 10:56:45 +02:00
alexandresalome
3cdf371c2b [TwigBundle] Move the {% render ... %} node to a dedicated extension + Remove service container
The purpose of the TemplatingExtension is ambigous. This first step move the actions logical
to a dedicated extension and reduce the dependency to the HTTP Kernel.
2011-05-24 10:56:45 +02:00
Bernhard Schussek
dcc61a9a98 Merge remote branch 'shieldo/search_field' into shieldo_merge 2011-05-19 01:41:59 +02:00
Bernhard Schussek
216d7e415d Merge remote branch 'mweimerskirch/form_pattern_attribute' into mweimerskirch_merge
Conflicts:
	src/Symfony/Bundle/TwigBundle/Resources/views/Form/div_layout.html.twig
	src/Symfony/Component/Form/Extension/Core/Type/FieldType.php
	src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
2011-05-18 22:49:27 +02:00
Bernhard Schussek
f467317bab [Form] Renamed view variable "name" to "full_name"
The variable "name" now contains the local, short name (equivalent to $form->getName()).
2011-05-18 22:16:16 +02:00
Fabien Potencier
7b4c12b7dc Merge remote branch 'ornicar/twigAssetsVersion'
* ornicar/twigAssetsVersion:
  Add `assets_version` twig function. Also add some phpDoc.
2011-05-17 18:48:53 +02:00
Fabien Potencier
3d85008141 Merge remote branch 'danielholmes/widget_templates'
* danielholmes/widget_templates:
  [TwigBundle] fixed form templates so divs won't have all the input attributes, some of which are invalid (such as required, maxlength, name, etc)
2011-05-17 09:19:03 +02:00
Douglas Greenshields
bf2f9d2a02 [Form] Added a search form field type 2011-05-15 18:31:36 +01:00
Bernhard Schussek
e0ff61949e [Form] Renamed the value "text" of the "widget" option of the "date" type to "single-text" 2011-05-13 19:17:28 +02:00
Daniel Holmes
b98f786d66 [TwigBundle] fixed form templates so divs won't have all the input attributes, some of which are invalid (such as required, maxlength, name, etc) 2011-05-05 11:20:08 +10:00
Michel Weimerskirch
476644a92c [Form] Support for the HTML5 "pattern" attribute, see http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#the-pattern-attribute
If you use the MinLength validator with your entities, the ValidatorTypeGuesser gets the value, stored as "minlength". Then, the FormFactory generates a "pattern" attribute out of minlength and maxlength.
Modern browsers such as Chrome use this attribute to validate the form before submitting.
a "pattern" attribute is generated that validates the
2011-05-04 23:16:41 +02:00
Bernhard Schussek
74cca63938 [Form] CSRF fields are not included in the children of a FormView anymore if the view is not the root 2011-05-04 18:27:20 +02:00
Bernhard Schussek
bf1dfbbe99 [Form] Added test for last commit by kriswallsmith and improved dealing with original names
The form component should now guarantee to always pass an UploadedFile object to your model. There you can call getOriginalName() to retrieve the original name of the uploaded file. For security reasons, the real file name is a generated hash value.
2011-05-04 17:04:44 +02:00
Fabien Potencier
d31c403bae Merge remote branch 'pborreli/tests-fix-typos'
* pborreli/tests-fix-typos:
  Various typos
  [WebProfilerBundle] Fixed typo
  [WebProfilerBundle] Adding unit tests
2011-04-30 21:53:15 +02:00
Pascal Borreli
391744719a Various typos 2011-04-30 19:40:15 +00:00
Igor Wiedler
aa8428632b [TwigBundle] Default $globals to null as in FrameworkBundle/PhpEngine 2011-04-29 22:53:45 +02:00
Igor Wiedler
e7c0aea587 make Templating Engine $globals optional 2011-04-29 22:36:24 +02:00
Fabien Potencier
a487c5200e Revert "[TwigBundle] removed the extends tags from the table layout (it's not needed anymore)"
This reverts commit 66a01855f7.
2011-04-29 11:03:45 +02:00
Fabien Potencier
66a01855f7 [TwigBundle] removed the extends tags from the table layout (it's not needed anymore) 2011-04-29 10:25:01 +02:00
Fabien Potencier
4bef9995c6 fixed typo 2011-04-26 16:02:24 +02:00
Fabien Potencier
e45d5fa857 merged vicb:template-factorization 2011-04-26 14:38:47 +02:00
Fabien Potencier
d6bdb7af88 Merge remote branch 'vicb/tweaks_110425'
* vicb/tweaks_110425:
  [AsseticBundle] Remove an unused property
  [Cache warmers] A few tweaks
2011-04-25 20:54:08 +02:00
Victor Berchet
829bc54392 [Cache warmers] A few tweaks 2011-04-25 11:57:41 +02:00
Pascal Borreli
8c0beea677 [Phpdoc] Cleaning/fixing 2011-04-23 15:18:47 +00:00
Victor Berchet
33dd89fd02 [Template cache warmers] Factorize common code 2011-04-23 11:24:28 +02:00
Fabien Potencier
b347aebee8 [TwigBundle] removed obsolete code 2011-04-23 11:00:54 +02:00
Fabien Potencier
55e6883a88 [TwigBundle] removed obsolete code 2011-04-23 10:55:52 +02:00
Pascal Borreli
325801b00a [TwigBundle] Removed useless code 2011-04-22 22:54:11 +00:00
Fabien Potencier
de8f10e236 Merge remote branch 'Infranology/framework-bundle-updated-method-call' into form
* Infranology/framework-bundle-updated-method-call: (91 commits)
  [FrameworkBundle] updated method call
  moved DoctrineMongoDBBundle to its own repository
  [AsseticBundle] fixed unit tests
  [FrameworkBundle] removed unneeded files in tests
  updated vendors
  [FrameworkBundle] removed the need to boot a Kernel in a unit test file
  [FrameworkBundle] removed the need to boot a Kernel in a unit test file
  [Routing] added getContext() accessor
  [HttpFoundation] fixed a potential security problem in Request
  updated vendors
  Added 201 to the possible status codes that indicate a response is a redirect.
  [FrameworkBundle] made ESI URL relative as allowed by the spec (no need to generate absolute URLs)
  [AsseticBundle] fixed router and controller
  [AsseticBundle] removed fake front controller from URL before creating route
  [AsseticBundle] updated twig integration to check debug mode at runtime rather than compile time since twig cannot vary its cache by debug mode
  [Routing] the global parameters must not be added in the QS when generating URLs
  removed the possibility to pass a message to the trans tag
  simplified exceptions as Twig is now smart enough to automatically add line information
  made the %count% variable automatically available when using the transchoice filter (similar to how the tag works)
  [Container] Added function array_unique on getServiceIds to return only one service name
  ...
2011-04-22 09:35:11 +02:00
Eriksen Costa
589b0ab4ed Merge branch 'master' into form-frameworkbundle-form-guessers-fix
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddFormGuessersPass.php
	src/Symfony/Component/Form/MoneyField.php
2011-04-21 23:03:40 -03:00
Ryan Weaver
f98916dcc8 [TwigBundle] Removing dbug text in form template 2011-04-21 19:49:45 -05:00
Fabien Potencier
9694ac77a7 [Form] fixed translations escaping 2011-04-21 07:48:12 +02:00
Bernhard Schussek
273d72ef75 [Form] Changed separator for Twig blocks from double underscore to single underscore to match the PHP template separator 2011-04-18 14:28:01 +02:00
Miha Vrhovnik
50011fa344 Added html5 email input to the forms 2011-04-18 11:17:41 +02:00
Brikou CARRE
e898445b94 removed empty lines/trailing spaces 2011-04-15 21:12:02 +02:00
Bernhard Schussek
7b1bf621e1 [Form] Removed obsolete code from div_layout.html.twig 2011-04-15 16:40:28 +02:00
Bernhard Schussek
990bef8afb [Form][FrameworkBundle][TwigBundle] Fixed: CSRF fields are not rendered for nested forms anymore 2011-04-15 14:05:33 +02:00
Henrik Bjørnskov
fbb0ca5c4e [Form] Fixed tests for previous commit 2011-04-14 18:32:51 +02:00
Henrik Bjørnskov
5547243f53 [Form] Starting to bring back resouces as configurable 2011-04-14 18:32:34 +02:00
Fabien Potencier
44edd8fe96 [TwigBundle] renamed default widget files 2011-04-14 16:47:44 +02:00
Bernhard Schussek
c6fe6a750d [Form] Added functional test for the 'size' attribute in the select tags of a time field 2011-04-14 15:29:55 +02:00
Bernhard Schussek
72b17cd67c [Form] Renamed TemplateContext to FormView 2011-04-14 15:02:51 +02:00
Bernhard Schussek
4907c7d81d [Form] Added test coverage for expanded choice fields 2011-04-14 14:18:25 +02:00
Bernhard Schussek
4c0d53a7b6 [TwigBundle] Merged div_layout.html.twig and widget.html.twig 2011-04-14 13:46:11 +02:00
Bernhard Schussek
ce5f3073bd Fixed test suite and names of accessor methods in TemplateContext 2011-04-14 03:52:52 +02:00
Bernhard Schussek
602846f386 [Form] Added tests for table_layout.html.twig 2011-04-14 03:38:19 +02:00
Bernhard Schussek
96f040cec1 [Form] Added extensive test coverage for div_layout.html.twig 2011-04-14 03:15:56 +02:00
Bernhard Schussek
8031ad77c8 Merge remote branch 'fabpot/form' into fabpot_merge 2011-04-13 15:58:15 +02:00
Kris Wallsmith
672291087c removed a lot of special normalization logic in the configuration by using xml values instead of attributes 2011-04-13 05:59:46 -07:00
Bernhard Schussek
2a18be1c9f Merge remote branch 'symfony/master' into experimental 2011-04-13 13:53:20 +02:00
Fabien Potencier
0c93b6bbe4 Merge remote branch 'vicb/locate_template2'
* vicb/locate_template2:
  [FrameworkBundle] Enforce templates instances of TemplateReferenceInterface
  [FrameworkBundle] Add unit tests for the CacheTemplateLocator class
  [FrameworkBundle] Add unit tests for the TemplateLocator class
  [TwigBundle] Fix the cache warmer
  [TwigBundle] Tweak cache warmer configuration
  [FrameworkBundle] Fix resource inheritance in the template cache warmer
2011-04-13 13:38:11 +02:00
Fabien Potencier
7f2294395c [Form] reverted the templating part to be similar to what we have today 2011-04-11 16:42:51 +02:00
Victor Berchet
e254ff8cc6 Display template logical names in exception messages 2011-04-08 19:56:12 +02:00
Victor Berchet
87000a163b [TwigBundle] Fix the cache warmer 2011-04-08 18:54:19 +02:00
Victor Berchet
e1ab14ba08 [TwigBundle] Tweak cache warmer configuration 2011-04-08 18:54:19 +02:00
Fabien Potencier
a230090537 removed some json_encode() calls to use the new getLogicalName() method instead 2011-04-08 17:28:27 +02:00
Bernhard Schussek
67582c9a5c Merge remote branch 'symfony/master' into experimental
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php
2011-04-06 16:06:26 +02:00
Victor Berchet
b640fcb0f0 [Config] Introduction of an ConfigurationInterface 2011-04-05 11:26:28 +02:00
Ryan Weaver
22beeb2549 [TwigBundle] Cleaning up several portions of the exception message received when a template cannot be loaded
* The quotations are redundant when the template is a string - json_encode() adds the quotes
 * The exception should not end in a period, as the exception class may add a line number (not in this case, but generall)
 * Made the line number -1, so that no line number was displayed in the message (error at line 0 looks worse than nothing at all)
2011-04-04 21:35:00 -05:00
Fabien Potencier
dd150fc478 Merge remote branch 'vicb/twig_warmer'
* vicb/twig_warmer:
  [TwigBundle] Update the cache warmer
2011-04-04 18:52:56 +02:00
Bernhard Schussek
bfa3c71140 [Form] Added Bundle suffixes again 2011-04-04 15:33:21 +02:00
Bernhard Schussek
0cf8cc762a Merge remote branch 'symfony/master' into experimental
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_field.html.php
	src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_field.html.php
2011-04-04 15:16:08 +02:00
Fabien Potencier
f232b3cdda reverted Merge remote branch 'kriswallsmith/kernel/shorter-bundle-names' 2011-04-04 11:10:56 +02:00
Fabien Potencier
743592d81e Revert "fixed remaining Bundle suffixes"
This reverts commit 315147c6c8.
2011-04-04 11:08:56 +02:00
Bernhard Schussek
d3b7c4e8c1 [Form] Moved getLabel(), isChoiceSelected() and isChoiceGroup() from ChoiceListInterface to ThemeRenderer 2011-04-02 14:14:18 +02:00
Bernhard Schussek
37e8e1270c [Form][FrameworkBundle][TwigBundle] Renamed view variable 'disabled' to 'read_only' to match with the according FormInterface methods 2011-04-02 12:18:43 +02:00
Fabien Potencier
b219e92bf4 [Form] fixed Twig theme tests 2011-03-31 07:27:55 +02:00
ornicar
d72b1d4f61 Add assets_version twig function. Also add some phpDoc.
I need to get the assets version to pass it to JavaScript. As there is
no obvious way to get it from a twig template actually, I think this
new `assets_version` function makes sense.
2011-03-30 11:14:19 -07:00
Bernhard Schussek
544f763c2c [FrameworkBundle][TwigBundle] Adapted bundle references to latest symfony/master changes 2011-03-28 22:58:05 +02:00
Bernhard Schussek
53838abf3f Merge remote branch 'symfony/master' into experimental
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_field.html.php
	src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_field.html.php
	src/Symfony/Component/Form/Resources/config/validation.xml
2011-03-28 22:52:15 +02:00
Victor Berchet
95f5ba1ccd [TwigBundle] Update the cache warmer 2011-03-28 22:04:39 +02:00
Fabien Potencier
315147c6c8 fixed remaining Bundle suffixes 2011-03-28 19:04:02 +02:00
Fabien Potencier
49063a5314 Merge remote branch 'kriswallsmith/kernel/shorter-bundle-names'
* kriswallsmith/kernel/shorter-bundle-names:
  updated codebase to use shorter bundle names
  [HttpKernel] updated component to work with shorter bundle names
  [HttpKernel] updated Bundle::getName() to validate bundle class name and rtrim "Bundle"
2011-03-28 18:06:41 +02:00
Fabien Potencier
faf9782e6f renamed Twig TransExtension to TranslationExtension 2011-03-28 16:16:54 +02:00
Kris Wallsmith
ade83e2e80 updated codebase to use shorter bundle names
Controllers:
"BlogBundle:Post:show" is now "Blog:Post:show"

Templates:
"BlogBundle:Post:show.html.twig" is now "Blog:Post:show.html.twig"

Resources:
"@BlogBundle/Resources/config/blog.xml" is now "@Blog/Resources/config/blog.xml"

Doctrine:
"$em->find('BlogBundle:Post', $id)" is now "$em->find('Blog:Post', $id)"
2011-03-27 06:25:43 -07:00