This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier 5d896f60f4 merged branch fabpot/proxy-route-fix (PR #6791)
This PR was merged into the master branch.

Commits
-------

cdf1d72 [FrameworkBundle] fixed requirement of the _controller palceholder for the proxy route (closes #6783)

Discussion
----------

[FrameworkBundle] fixed requirement of the _controller palceholder for the proxy route (closes #6783)

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6783
| License       | MIT
| Doc PR        | n/a

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

by vicb at 2013-01-18T10:23:06Z

What about a UT ?

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

by vicb at 2013-01-18T11:28:41Z

and the syntax is wrong also !

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

by gimler at 2013-01-21T19:59:57Z

same problem the sonata admin bundle use
```
{% render 'sonata.admin.controller.admin:getShortObjectDescriptionAction' %}
```

rewrite to
```
{% render controller('sonata.admin.controller.admin:getShortObjectDescriptionAction') %}
```
throws
```
An exception has been thrown during the rendering of a template ("Parameter "_controller" for route "_proxy" must match "[^/\.]++" ("sonata.admin.controller.admin:getShortObjectDescriptionAction" given) to generate a corresponding URL.") in "SonataAdminBundle:CRUD:edit.html.twig".
```
with the requirement fix it throws
```
An exception has been thrown during the rendering of a template ("Unable to parse the controller name "sonata".") in "SonataAdminBundle:CRUD:edit.html.twig".
```

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

by fabpot at 2013-01-22T06:40:14Z

ok, I've updated the patch. There is now a static segment (`/for`) between the controller and the format, which should fix the problem.

While thinking about this, there is another option, which might be even better: removing the need for the proxy route altogether and check for a defined path like `/_proxy`. It would remove the dependency on a Url Generator in the rendering strategy, and would not make the router proxy listener any more complex.

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

by gimler at 2013-01-22T07:20:43Z

+1 for me the patch works i will open a PR for sonata doctrine orm bundle
```
{% render controller('sonata.admin.controller.admin:getShortObjectDescriptionAction', {},  {
    'code':     sonata_admin.field_description.associationadmin.code,
    'objectId': sonata_admin.field_description.associationadmin.id(sonata_admin.value),
    'uniqid':   sonata_admin.field_description.associationadmin.uniqid
})
```

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

by gimler at 2013-01-22T07:22:21Z

When the proxy route is nessesary we should add a note into the upgrade guide.

+1 for less complexesy

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

by fabpot at 2013-01-22T08:02:12Z

There is one issue with removing the proxy route: when generating a proxy URL, we need a Request instance, which is not always the case. I'm going to submit another PR to "fix" that first.

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

by vicb at 2013-01-22T08:17:51Z

> It would remove the dependency

Paul leaves this body :)

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

by Tobion at 2013-01-22T08:53:52Z

I don't think removing the proxy route is good. That's the purpose of the routing system to handle generating and matching. Now if you do it manually it will probably show a bad approach to people to handle such stuff.
Also people cannot see what routes are defined explicitly and use tools like `router:debug`.

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

by fabpot at 2013-01-22T09:28:55Z

@Tobion: see #6829

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

by fabpot at 2013-01-22T09:57:57Z

I've again changed the route pattern to avoid any possible problems (even if a controller contains a `/`).

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

by Tobion at 2013-01-22T10:16:03Z

Can a controller contain `/`? It's neither a valid service nor a valid class name or?

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

by mvrhov at 2013-01-22T10:40:26Z

AFAIK yes, at least I used Namespace/SubController more then once...
2013-01-22 12:03:36 +01:00
src/Symfony [FrameworkBundle] fixed requirement of the _controller palceholder for the proxy route (closes #6783) 2013-01-22 10:57:00 +01:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore ignore composer.phar 2012-04-20 14:10:06 +01:00
.travis.yml Merge branch '2.1' 2013-01-05 16:33:05 +01:00
autoload.php.dist [travis-ci] Zend Garbage Collection only for PHP5.4 2012-11-19 15:21:43 +01:00
CHANGELOG-2.0.md updated CHANGELOG for 2.0.22 2013-01-17 16:39:41 +01:00
CHANGELOG-2.1.md updated CHANGELOG for 2.1.7 2013-01-17 17:21:31 +01:00
composer.json [Monolog] Mark old non-PSR3 methods as deprecated 2013-01-09 10:19:50 +01:00
CONTRIBUTING.md Making it easier to grab the PR template. 2012-12-15 21:57:27 +00:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.0.22 2013-01-17 16:40:10 +01:00
LICENSE updated license year 2013-01-04 17:59:43 +01:00
phpunit.xml.dist [travis-ci] Zend Garbage Collection only for PHP5.4 2012-11-19 15:21:43 +01:00
README.md Merge branch '2.0' into 2.1 2012-12-20 08:21:29 +01:00
UPGRADE-2.1.md Merge branch '2.1' 2012-11-29 11:32:45 +01:00
UPGRADE-2.2.md fixed markup 2013-01-19 08:50:02 +01:00
UPGRADE-3.0.md [Yaml] deprecated the possibility to pass a file name to Yaml::parse() 2013-01-17 15:01:21 +01:00

README

What is Symfony2?

Symfony2 is a PHP 5.3 full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog to high traffic ones like Dailymotion or Yahoo! Answers.

Requirements

Symfony2 is only supported on PHP 5.3.3 and up.

Be warned that PHP versions before 5.3.8 are known to be buggy and might not work for you:

Installation

The best way to install Symfony2 is to download the Symfony Standard Edition available at http://symfony.com/download.

Documentation

The "Quick Tour" tutorial gives you a first feeling of the framework. If, like us, you think that Symfony2 can help speed up your development and take the quality of your work to the next level, read the official Symfony2 documentation.

Contributing

Symfony2 is an open source, community-driven project. If you'd like to contribute, please read the Contributing Code part of the documentation. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section and use Pull Request Template.

Running Symfony2 Tests

Information on how to run the Symfony2 test suite can be found in the Running Symfony2 Tests section.