Commit Graph

7986 Commits

Author SHA1 Message Date
lsmith77
6e987307fc added forwards compatibility for the Filesystem component 2011-12-25 14:02:01 +01:00
Drak
79793e442a Coding standards and removing whitespace. 2011-12-24 15:50:47 +05:45
Fabien Potencier
b498138471 merged branch willdurand/filesystem-component (PR #2949)
Commits
-------

4afc6ac Updated CHANGELOG-2.1
3d3239c Added Filesystem Component mention in composer.json
5775a0a Added composer.json
b26ae4a Added README
fbe9507 Added LICENSE
818a332 [Component] Moved Filesystem class to its own component

Discussion
----------

Filesystem component

Related to #2946

William

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

by stof at 2011/12/22 10:58:25 -0800

you need to add the new component in the ``replace``  section of the main composer.json, and you also need to add it as a dependency for FrameworkBundle as it defines a service using it.

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

by stof at 2011/12/22 10:59:34 -0800

and you need to update the changelog file

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

by willdurand at 2011/12/22 11:06:04 -0800

@stof thanks. Is it ok ?

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

by stof at 2011/12/22 11:13:31 -0800

mentioning the move only once in the changelog would probably be enough (and it is especially not needed in the FrameworkBundle section IMO) but otherwise it's fine
2011-12-24 09:15:42 +01:00
Fabien Potencier
d149aa7b2b merged branch stloyd/profile_simplify (PR #2950)
Commits
-------

9daa2a6 [Profiler] Add function to get parent token directly

Discussion
----------

[Profiler] Add function to get parent token directly

```
Bug fix: no
Feature addition: kinda
Backwards compatibility break: no
Symfony2 tests pass: yes
2011-12-24 09:13:41 +01:00
Matthias Pigulla
cae7db0d19 Be more tolerant and also accept <esi:include ...></esi:include>, also if it is not 100% standards compliant. 2011-12-23 19:02:12 +01:00
Joseph Bielawski
9daa2a6cc8 [Profiler] Add function to get parent token directly 2011-12-23 09:45:13 +01:00
Fabien Potencier
d635be4e20 fixed merge 2011-12-23 09:21:58 +01:00
Fabien Potencier
5b2bc7d7f9 merged 2.0 2011-12-23 08:57:06 +01:00
Fabien Potencier
bebdd07f41 [TwigBridge] simplified code 2011-12-23 08:55:49 +01:00
Fabien Potencier
74cfd04504 [Security] made the logout path check configurable 2011-12-23 08:28:15 +01:00
William DURAND
4afc6acc9e Updated CHANGELOG-2.1 2011-12-22 20:04:58 +01:00
William DURAND
3d3239c29b Added Filesystem Component mention in composer.json
- In the global Symfony2 composer.json file as a replacement
- In the FrameworkBundle composer.json file as a requirement
2011-12-22 20:02:15 +01:00
William DURAND
5775a0a24a Added composer.json 2011-12-22 19:44:28 +01:00
William DURAND
b26ae4aac3 Added README 2011-12-22 19:43:09 +01:00
William DURAND
fbe950721b Added LICENSE 2011-12-22 19:42:52 +01:00
William DURAND
818a3321c0 [Component] Moved Filesystem class to its own component 2011-12-22 19:36:46 +01:00
Fabien Potencier
4404d6f0be merged branch stof/entity_provider_registry (PR #2928)
Commits
-------

373ab4c Fixed tests added from 2.0
9653be6 Moved the EntityFactory to the bridge
caa105f Removed useless use statement
24319bb [DoctrineBridge] Made it possible to change the manager used by the provider

Discussion
----------

[DoctrineBridge] Made it possible to change the manager used by the provider

This improves the support of several entity managers by allowing using a non-default one for the provider.

It is BC for the user as the default value for the name is ``null`` which means using the default one.

I'm preparing the PR for DoctrineBundle too

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

by stof at 2011/12/19 14:16:38 -0800

I'm wondering if the EntityFactory used to integrate the bundles with SecurityBundle should be moved to the bridge or not. Moving it (making the key and the abstract service id configurable) would allow reusing it in all Doctrine bundles instead of copy-pasting it (see the CouchDBBundle pull request linked above).
The bridge was initially meant to integrate third party libraries with the components and this class is about the SecurityBundle, not the component. But on the other hand, we already share the abstract DI extension between the bundles using the bridge.

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

by stof at 2011/12/19 14:17:48 -0800

@fabpot @beberlei thoughts ?

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

by stof at 2011/12/21 04:43:50 -0800

@fabpot @beberlei what do you thing about moving the EntityFactory to the bridge ?

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

by henrikbjorn at 2011/12/21 05:10:56 -0800

Missing mongodb bundle

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

by stof at 2011/12/21 05:52:06 -0800

@henrikbjorn I was planning to send the PR for mongodb too but the namespace change was not merged yet yesterday. And now, you want to wait for the answer to know if I need to copy-paste the factory to the mongodb bundle too or if I move it to the bridge

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

by beberlei at 2011/12/21 15:14:17 -0800

I think moving it to the Bridge makes sense if we can re-use across all the bundles then. Also it is really about integrating security with doctrine, so its a bridge topic.

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

by stof at 2011/12/22 08:39:52 -0800

I updated the PR to move the factory to the bridge. The DoctrineBundle and DoctrineCouchDBBundle PRs are updated too.

@fabpot the PR should be ready to be merged

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

by fabpot at 2011/12/22 08:53:02 -0800

Tests do not pass for me:

    ...E

    Time: 0 seconds, Memory: 14.75Mb

    There was 1 error:

    1) Symfony\Tests\Bridge\Doctrine\Security\User\EntityUserProviderTest::testSupportProxy
    Argument 1 passed to Symfony\Bridge\Doctrine\Security\User\EntityUserProvider::__construct() must implement interface Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\ORM\EntityManager given, called in tests/Symfony/Tests/Bridge/Doctrine/Security/User/EntityUserProviderTest.php on line 89 and defined

    src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php:35
    tests/Symfony/Tests/Bridge/Doctrine/Security/User/EntityUserProviderTest.php:89

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

by stof at 2011/12/22 08:56:33 -0800

@fabpot I fixed it before your comment (thanks travis ^^). It was the test added in my other PR to 2.0 and so not updated in the original commit. I forgot it when rebasing
2011-12-22 17:59:27 +01:00
Christophe Coevoet
373ab4c50f Fixed tests added from 2.0 2011-12-22 17:52:42 +01:00
Fabien Potencier
afa683a6e8 merged branch Burgov/doctrine_choice_with_proxy_object_fix (PR #2944)
Commits
-------

0a9ea26 fixed the display of the current value in a doctrine entity type, when the current value is for example an instance of Doctrine\Orm\Proxy\Proxy and is not yet initialized

Discussion
----------

fixed the display of the current value in a doctrine entity type

 when the current value is an instance of Doctrine\Orm\Proxy\Proxy

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

Arguably, this is a Doctrine issue rather than a Symfony one, but when the current value in the entity type is a proxy instance, no item is selected, because "$this->reflFields[$this->identifier[0]]->getValue($entity);" (in ClassMetadata) always returns null unless the entity is loaded

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

by Gregwar at 2011/12/22 07:07:34 -0800

+1 for this

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

by stof at 2011/12/22 08:30:44 -0800

@fabpot this is good for the merge now
2011-12-22 17:50:22 +01:00
Christophe Coevoet
9653be618a Moved the EntityFactory to the bridge 2011-12-22 16:54:29 +01:00
Bart van den Burg
0a9ea2614c fixed the display of the current value in a doctrine entity type, when the current value is for example an instance of Doctrine\Orm\Proxy\Proxy and is not yet initialized 2011-12-22 16:37:13 +01:00
Christophe Coevoet
caa105fef9 Removed useless use statement 2011-12-22 16:14:18 +01:00
Christophe Coevoet
24319bb0f4 [DoctrineBridge] Made it possible to change the manager used by the provider 2011-12-22 16:14:12 +01:00
Fabien Potencier
10c60ab5d5 merged branch Burgov/fix_entity_choice_list (PR #2942)
Commits
-------

c60f036 fixed typo
231e79c fixed entity choice list BC break

Discussion
----------

fixed EntityChoiceList BC break

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

This PR resolves a serious BC break introduced in commit b919d92b52
Prior to this commit, it was possible to use the entity shorthand notation in the EntityChoiceList constructor, but it broke because the EntityChoiceList now expects the second argument to be the actual class name

There is another issue at hand here, but I'm not sure how to fix it:

The EntityChoiceManager expects an Doctrine\Common\Persistence\ObjectManager instance, then the ClassMetadata is fetched from it and the method getIdentifierFieldNames is called on it. Yet, according to the docblock, getClassMetadata of the ObjectManager returns an instance of Doctrine\Common\Persistence\Mapping\ClassMetadata, which doesn't have a getIdentifierFieldNames() method.

So either the EntityChoiceList should expect an instance of EntityManager, or it should be rewritten to not use getIdentifierFieldNames() anymore.

Any ideas?

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

by fabpot at 2011/12/22 03:48:49 -0800

ping @beberlei

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

by beberlei at 2011/12/22 04:02:30 -0800

The fix is valid

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

by stof at 2011/12/22 04:54:53 -0800

@beberlei getIdentifierFieldNames should probably be added in the interface too. Currently, we only have isIdentifier in it.

This methods needs to be implemented in the MongoDB ODM though (simply returning ``array($this->getIdentifier())``
2011-12-22 14:10:23 +01:00
Bart van den Burg
c60f0363de fixed typo 2011-12-22 10:57:47 +01:00
Bart van den Burg
231e79ce0f fixed entity choice list BC break 2011-12-22 10:49:27 +01:00
Fabien Potencier
0fa9e4cb69 [HttpKernel] fixed some unit tests that can fail 2011-12-22 08:06:15 +01:00
Fabien Potencier
473741b9db added the possibility to change a StreamedResponse callback after its creation 2011-12-22 07:58:59 +01:00
Fabien Potencier
2dff183a07 merged branch kriswallsmith/http/apache-request (PR #2940)
Commits
-------

1b4aaa2 [HttpFoundation] fixed ApacheRequest

Discussion
----------

[HttpFoundation] fixed ApacheRequest

Pathinfo was incorrect when using mod_rewrite.
Added better test coverage.
2011-12-22 07:29:49 +01:00
Kris Wallsmith
1b4aaa2c8e [HttpFoundation] fixed ApacheRequest
Pathinfo was incorrect when using mod_rewrite.
Added better test coverage.
2011-12-21 13:57:56 -08:00
Fabien Potencier
8717d4425e moved a test in the constructor 2011-12-21 18:53:18 +01:00
Fabien Potencier
e44b8ba521 made some cosmetic changes 2011-12-21 18:34:44 +01:00
Fabien Potencier
2af5cb5602 merged branch marekkalnik/upload-flash (PR #2938)
Commits
-------

8235848 [HttpFoundation][File] Add flv file default extension

Discussion
----------

[HttpFoundation][File] Add flv file default extension

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes (doesn't affect tests)
Fixes the following tickets: -
Todo: -

This commit adds default extension for video/x-flv mime-type, which is a Flash Video file. Lack of this definition causes File::guessExtension() return null for this type of file, which breaks uploaded file in some user cases.
2011-12-21 17:08:06 +01:00
Fabien Potencier
74ef9b963e merged branch mdemirci/2.0 (PR #2937)
Commits
-------

5a6c989 FrameworkBundle: Adding test-attribute in xsd-schema to write functional-tests if using xml-configurations

Discussion
----------

[FrameworkBundle] Adding test-attribute in xsd-schema

 to write functional-tests if using xml-configurations
2011-12-21 17:07:45 +01:00
Marek Kalnik
8235848b5b [HttpFoundation][File] Add flv file default extension 2011-12-21 16:18:42 +01:00
Muharrem Demirci
5a6c989abc FrameworkBundle: Adding test-attribute in xsd-schema to write functional-tests if using xml-configurations 2011-12-21 15:50:59 +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
cc8f3086df Merge branch '2.0'
* 2.0:
  [HttpKernel] fixed unit tests that can fail randomly
2011-12-21 14:29:13 +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
3dd1072edc [HttpKernel] fixed unit tests that can fail randomly 2011-12-20 20:21:56 +01:00
Fabien Potencier
5803146a9e merged 2.0 2011-12-20 20:16:39 +01:00
Fabien Potencier
ebc9979a57 [Process] fixed unit tests on PHP 5.4 2011-12-20 20:16:11 +01:00
Fabien Potencier
89bd0d7874 merged branch Tobion/patch-3 (PR #2931)
Commits
-------

1eb5583 fixes #2906

Discussion
----------

Fix for #2906

closes #2906
2011-12-20 19:20:41 +01:00
Tobias Schultze
1eb5583168 fixes #2906 2011-12-20 18:12:37 +01:00
Fabien Potencier
34f1b5893c merged branch aerialls/webprofiler (PR #2925)
Commits
-------

b0987a3 [WebProfilerBundle] fixed toolbar height

Discussion
----------

[WebProfilerBundle] fixed toolbar height

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: none
Todo: none
2011-12-19 19:53:40 +01:00
Fabien Potencier
a4edc1b724 updated CHANGELOG for 2.1 2011-12-19 19:52:36 +01:00
Fabien Potencier
05285e429c merged branch dustin10/cache-clearers (PR #2857)
Commits
-------

3ae976c fixed CS
84ad40d added cache clear hook

Discussion
----------

[Cache][2.1] Added cache clear hook

Allows bundles to hook into the `cache:clear` command by using the `kernel.cache_clearer` tag instead of using the `event_dispatcher` service.

See #1884

Bug fix: No
Feature addition: Yes
Backwards compatibility break: No
Symfony2 tests pass: Yes
Fixes the following tickets: #1884
References the following tickets: #1884

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

by dustin10 at 2011/12/16 11:03:54 -0800

Rebased to squash all commits into one.

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

by lsmith77 at 2011/12/17 05:27:29 -0800

@fabpot: we figured that priorities wouldn't be needed for cleaning .. haven't tested the PR, but conceptually it looks good to me and aside from the priority stuff its modeled after the cache warners.

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

by dustin10 at 2011/12/19 09:46:26 -0800

@fabpot Updated to pass cache dir to `clear` method.

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

by dustin10 at 2011/12/19 10:02:21 -0800

@stof and @fabpot Another thought I just had. Should the `$this->getContainer()->get('cache_clearer')->clear($realCacheDir);` call in the `CacheClearCommand` be done before the warming?

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

by stof at 2011/12/19 10:03:59 -0800

indeed. the clearing should be done before the warming.

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

by dustin10 at 2011/12/19 10:19:28 -0800

Squashed all commits into one. Let me know if there is anything else.

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

by dustin10 at 2011/12/19 10:31:50 -0800

Fixed extra lines.
2011-12-19 19:52:15 +01:00
Fabien Potencier
f58cfc0dcb merged branch stof/entity_provider_proxy (PR #2922)
Commits
-------

649fa52 [DoctrineBridge] Fixed the entity provider to support proxies
29f4111 [DoctrineBridge] Added a failing test showing the issue for proxy users

Discussion
----------

Fixed the entity provider to support proxies

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

If a proxy object was used, the ``supportsClass`` method would fail becasue it does a string comparison for the class name.

This issue has not been reported by users yet because it is an edge case:

- ``supportsClass`` is used only in the RememberMe system
- getting a proxy in the entity provider is possible only if a listener running before the firewall loaded an object which has a relation to the user, which is far from being a standard use case.

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

by schmittjoh at 2011/12/19 10:07:46 -0800

How about using the new proxy tools that Doctrine has?

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

by stof at 2011/12/19 10:20:37 -0800

the new tool will only be available in 2.2 so only for Symfony 2.1. Once merged into master, we could eventually refactor it in the master branch to use ``Doctrine\Common\Util\ClassUtils``
2011-12-19 19:50:04 +01:00
Fabien Potencier
ce41b8eafa merged branch stof/entity_provider (PR #2923)
Commits
-------

f1199c0 [DoctrineBridge] Decoupled the EntityUserProvider from the ORM

Discussion
----------

[DoctrineBridge] Decoupled the EntityUserProvider from the ORM

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

The entity provider can now be used by any Doctrine project implementing the interfaces from Doctrine Common 2.2.
2011-12-19 19:48:33 +01:00
Fabien Potencier
ddf6534cc6 merged branch stof/doctrine_choice_list (PR #2921)
Commits
-------

200ed54 [DoctrineBridge] Extracted the common type and made the choice list generic
3c81b62 [Doctrine] Cleanup and move loader into its own method
7646a5b [Doctrine] Dont allow null in ORMQueryBuilderLoader
988c2a5 Adjust check
3b5c617 [DoctrineBridge] Remove large parts of the EntityChoiceList code that were completly unnecessary (code was unreachable).
b919d92 [DoctrineBridge] Optimize fetching of entities to use WHERE IN and fix other inefficencies.
517eebc [DoctrineBridge] Refactor entity choice list to be ORM independant using an EntityLoader interface.

Discussion
----------

[DoctrineBridge] Refactor EntityChoiceList

Bug fix: no
Feature addition: yes
Backwards compatibility break: no (99%)
Symfony2 tests pass: yes

This decouples the ORM from the EntityChoiceList and makes its much more flexible. Instead of having a "query_builder" to do smart or complex queries you can now create "loader" instances which can arbitrarily help loading entities.

Additionally i removed lots of code that was unnecessary and not used by the current code.

There is a slight BC break in that the EntityChoiceList class is now accepting an EntityLoaderInterface instead of a querybuilder. However that class was nested inside the EntityType and should not be widely used or overwritten.

The abstract class DoctrineType is meant to be used as base class by other Doctrine project to share the logic by simply using a different type name and a different loader implementation.

This PR replaces #2728.

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

by beberlei at 2011/12/19 09:20:43 -0800

Thanks for doing the last refactorings, this is now fine from my side as well.
2011-12-19 19:46:30 +01:00