Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symfony routing #800

Merged
merged 29 commits into from
Jul 31, 2014
Merged

symfony routing #800

merged 29 commits into from
Jul 31, 2014

Conversation

WouterSioen
Copy link
Member

@WouterSioen WouterSioen commented Jul 24, 2014

Integrating the Symfony routing component. This will make it easier to route some code to full stack Symfony (Bundles) when other code is still run on the legace code of Fork.

  • Replace the code in the routing.php file with the Symfony routing component
  • Load routes from a yaml file
  • Generate url's with the routing component

Things that should be done in a follow up request

  • Pass the variables from the url directly to the needed class (controller)
    • Backend: module, action, language
    • Frontend: url

Note: since frontend url's are that custom, only the backend url's are generated with the Symfony routing component (for now).

Related issue: #409

Not all tasks in this commit are done, but I think this already changes enough to not work futher on this pull request, and do further integration in other branches.

woutersioen added 17 commits July 23, 2014 17:01
Note: for now, we just set the application name from this "controller".
We allready have our module, action and language variables here. These
should be passed to the Action class.
The router is the only place in Fork where we define applications.
There's no need for unnecessary defensive programming.
They still give problems at this moment with the Symfony routing
component.
This way, we'll be able to use the Symfony routing from the
Frameworkbundle.
Only the request handling and the defineForkConstants are still custom
functions.
This way, it'll be easier to check if all needed services are registered
correctly.
@WouterSioen
Copy link
Member Author

This pull requests also contains integration with the Symfony console. I closed my other pull request integrating it (#733) in favor of this one. These commands are allready available:

  • assets:install
  • cache:clear
  • cache:warmup
  • config:dump-reference
  • container:debug
  • server:run
  • translations:update

Not all commands work as intended yet. This was added in the first place for the container:debug command. This command allready works perfectly.

@WouterSioen WouterSioen self-assigned this Jul 24, 2014
woutersioen added 3 commits July 25, 2014 11:41
This way, we're sure all our functions mimic the Symfony kernel and we
only need to overwrite functions that have a different implementation.
@WouterSioen WouterSioen changed the title [WIP] symfony routing symfony routing Jul 28, 2014
path: /api
defaults:
_controller: ApplicationRouting::apiController
frontend:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may also want to look at Symfony2 CMF Bundle in another step. This would enable you to no longer need a catch all route like this but instead do lookups if a page exists in the routing layer itself. This would also make it possible to eventually support different controllers for different types of content.

http://symfony.com/doc/master/cmf/components/routing/index.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip. I was allready looking at the chainRouter for further work, but the CMF bundle could indeed be a good step in the direction we want to take.

We stille have a lot of work though, before we can fully switch our routing to the Symfony stack. This is just a small step in the right direction.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, would take it step by step. ie. this PR already touches a lot of stuff.

@lsmith77
Copy link

With assets:install maybe there is also a way to support this feature for forkcms modules, which in turn could make it possible to move the index.php put of the doc root?

@WouterSioen
Copy link
Member Author

In an old version we had our index page out of the document root. We changed this to help people use ForkCMS on cheap shared hosting where you can only upload files in your document root.

I am an advocate for moving the index page in a web folder, but I guess this is something we'll have to discuss with the other ForkCMS contributors/owners.

Poke @forkcms/core-contributors

@lsmith77
Copy link

I think its ok to have it as the default in the root but make it possible to have it outside the root. Having it outside of the root improves security considerably, something that novice users especially will appreciate.

@tijsverkoyen
Copy link
Member

:+1000000000000000: for moving the index.php into the web-folder

@WouterSioen
Copy link
Member Author

Note to self: The ajax and cronjob endpoints have been changed in the core, I have to change it too in this PR.

@tijsverkoyen
Copy link
Member

👍

@WouterSioen
Copy link
Member Author

@tijsverkoyen does your 👍 mean we can merge this tomorrow before releasing the 3.7.2 version?

@tijsverkoyen
Copy link
Member

yep, but release it as 3.8

On 30 Jul 2014, at 14:59, Wouter Sioen notifications@github.com wrote:

@tijsverkoyen does your mean we can merge this tomorrow before releasing the 3.7.2 version?


Reply to this email directly or view it on GitHub.

@WouterSioen
Copy link
Member Author

@tijsverkoyen Why would you release it as 3.8? There aren't any backwards compatibility breaks and 95% of the Fork users will never notice the difference.

@WouterSioen WouterSioen merged commit 9f74a16 into master Jul 31, 2014
@tijsverkoyen
Copy link
Member

Well I thought this was a major change, but if it is fully backward compatible you can release it as 3.7.2

On 30 Jul 2014, at 15:19, Wouter Sioen notifications@github.com wrote:

@tijsverkoyen Why would you release it as 3.8? There aren't any backwards compatibility breaks and 95% of the Fork users will never notice the difference.


Reply to this email directly or view it on GitHub.

@WouterSioen
Copy link
Member Author

There were still some issues with the installer, but these are now fixed. I'll still test the other pull requests assigned to me and then, we'll start releasing the new version.

@WouterSioen WouterSioen deleted the feature-symfony-routing branch July 31, 2014 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants