Commit Graph

8017 Commits

Author SHA1 Message Date
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
Julien Brochet
b0987a3c9c [WebProfilerBundle] fixed toolbar height 2011-12-19 19:44:57 +01:00
Dustin Dobervich
3ae976cd5a fixed CS 2011-12-19 12:30:32 -06:00
Dustin Dobervich
84ad40dcc8 added cache clear hook 2011-12-19 12:17:48 -06:00
Christophe Coevoet
649fa5219f [DoctrineBridge] Fixed the entity provider to support proxies 2011-12-19 18:32:21 +01:00
Christophe Coevoet
29f4111f3e [DoctrineBridge] Added a failing test showing the issue for proxy users 2011-12-19 18:31:29 +01:00
Christophe Coevoet
f1199c0c68 [DoctrineBridge] Decoupled the EntityUserProvider from the ORM
It can now be used by any Doctrine project implementing the interfaces
from Doctrine Common 2.2.
2011-12-19 18:20:00 +01:00
Christophe Coevoet
200ed5490b [DoctrineBridge] Extracted the common type and made the choice list generic 2011-12-19 17:53:23 +01:00
Fabien Potencier
694c74da30 merged branch stloyd/proper_asserts (PR #2916)
Commits
-------

fd174a2 [Tests] Use proper assertion for counting

Discussion
----------

[Tests] Use proper assertion for counting

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

Docs PR: symfony/symfony-docs#924
2011-12-19 17:50:54 +01:00
Benjamin Eberlei
3c81b62955 [Doctrine] Cleanup and move loader into its own method 2011-12-19 17:46:18 +01:00
Benjamin Eberlei
7646a5bc6d [Doctrine] Dont allow null in ORMQueryBuilderLoader 2011-12-19 17:46:09 +01:00
Benjamin Eberlei
988c2a525e Adjust check 2011-12-19 17:46:04 +01:00
Benjamin Eberlei
3b5c617ad0 [DoctrineBridge] Remove large parts of the EntityChoiceList code that were completly unnecessary (code was unreachable). 2011-12-19 17:45:59 +01:00
Benjamin Eberlei
b919d92b52 [DoctrineBridge] Optimize fetching of entities to use WHERE IN and fix other inefficencies. 2011-12-19 17:45:50 +01:00
Benjamin Eberlei
517eebcb31 [DoctrineBridge] Refactor entity choice list to be ORM independant using an EntityLoader interface. 2011-12-19 17:32:04 +01:00
Joseph Bielawski
fd174a228b [Tests] Use proper assertion for counting 2011-12-19 10:00:41 +01:00
Fabien Potencier
30f2be3b70 merged branch juliendidier/twig-security-class (PR #2835)
Commits
-------

60ebaaa [SecurityBundle] fix service class by adding a parameter, on twig extension

Discussion
----------

[SecurityBundle] fix service class by adding a parameter, on twig extension

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

To override the is_granted twig function, the class of TwigExtension is now set in a parameter.

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

by stof at 2011/12/10 10:38:38 -0800

First thing, you could overwrite the extension at the twig level by simply registering another twig extension with the same ``getName`` method.

And second point, replacing core Twig functions is probably one of the best way to forbid you to use third party bundles as the change will also impact their code. Do you really need to do it (especially considering that this function simply calls the security context and all the logic is in the context) ?

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

by juliendidier at 2011/12/10 15:43:08 -0800

Yes, overriding ```is_granted``` function is probably a bad example. But having it set as parameter allow you to redefine it (if you know what you are doing).
2011-12-19 08:06:39 +01:00
Fabien Potencier
e6e78f6a81 [TwigBundle] added Twig Debug extension support 2011-12-18 20:55:28 +01:00
Fabien Potencier
5d6a7d35b0 merged 2.0 2011-12-18 14:48:17 +01:00
Fabien Potencier
4316595dbb fixed CS 2011-12-18 14:42:59 +01:00