swCrossLinkApplicationPlugin - 1.2.2
Cross Application Link feature
You are currently browsing
the website for symfony 1
Add cross application link in your project.
PLEASE NOTE : THE SYMFONY REPOSITORY IS NOT USED ANYMORE, PLEASE USE THE ONE ON GITHUB : http://github.com/rande/swCrossLinkApplicationPlugin
|Thomas Rabaix||lead||moc.bewoelos <<ta>> xiabar.samoht|
Copyright (c) 2009 Soleoweb SARL - Thomas Rabaix <email@example.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
More info at : http://rabaix.net/en/articles/2009/07/13/cross-link-application-with-symfony-part-2
The configuration format has been updated. You can now specify the routes to be loaded for each environnement.
Enable the feature, edit your app.yml
all: swToolbox: cross_link_application: frontend: enabled: on # enable the feature load: backend: routes: # routes to load, leave empty will load all the routes - homepage - edit_blog env: # define the environment dev: rabaix.net/backend.php # define the full path for the dev environnement prod: rabaix.net/backend # define the full path for the prod environnement backend: enabled: on load: frontend: routes: - homepage - edit_blog env: dev: rabaix.net/frontend_dev.php prod: rabaix.net
Edit your factories.yml
all: routing: class: swPatternRouting
In your frontend's template, you can access to a backend route like this
<?php link_to('Edit Blog Post', '@backend.edit_post?id='.$blog->getId()) ?>
that's all !!
If you load too many routes, the application can be very slow in development. You can save seconds by simply turn off the debug options.
[yml] all: routing: class: swPatternRouting param: debug: false # default is true in dev mode.
Of course don't forget to reload the cache once the routing.yml file is updated
Please take a note that the default cache handler for routing is the sfFileCache. This can also slow down the application because php has to serialize and unserialize the cache.
Some input :
So in production you might need to tweak the routing caching strategy