Symfony’s ParamConverter is a common way to transform some GET param to an entity before your controllers action.
This happens most of the time via type hinting and priority detection kinda magic in the background.
But as magic is often obscure sometimes you need a bit of explicitness.
F.e. when you have more and different ParamConverter per entity you want to name them explicitly.
Then you can use named ParamConverters.
In the documentation this issue is a bit fragmented, so here is the compact version:
Continue reading “Symfony and named ParamConverters”
I have often missed the
method from Doctrine1 in Symfony2 with Doctrine2.
Of course there’s the doctrine extensions with the sluggable behaviour, but sometimes it seems a bit overhead for smaller tasks.
I just recently discovered Behat Transliterator, which brings just the dearly missed urlize function back.
Continue reading “Symfony2 “urlize””
I usually would not recommend deployment via git and running composer on your prod server for several reasons like f.e. the network. I rather believe in builds.
But sometimes its just too convenient :)
So i have this uncritical smaller API app where the hosting has git, ssh access and i am in full control and i decided too keep it simple.
Continue reading “git deploy with composer install hook”
As of 2014 things have
changed improved a lot in the Symfony / Silex world, compared to 2011, when i first blogged about twig extensions in Silex.
Things got more easy, yay!
As Composer appeared, installation and autoloading is a breeze nowadays.
I presume here, that you have installed your Silex project via composer.
If so, you can install the twig extensions like this:
Continue reading “Enable Twig-Extensions in Silex revisited”
In a recent website-project i had a WordPress Blog running next to the main CMS Silverstripe, handling the Blog-part of the site.
Integrating the Blog in Silverstripe (which indeed would have made things simpler) was not an option at the time. The usage of loads of WordPress plugins would’ve made a rewrite a major task, which was out of the budget.
The blog was integrated in the same page layout as the rest of the website. So ideally it would at least share the same Templates for header, footer etc. and would integrate the sites navigation built by Silverstripe.
But how to use the pre-rendered Silverstripe template
.ss files in a WordPress theme?
The following worked fine for me, using Silverstripe 3.0:
Continue reading “Using Silverstripe Templates outside Silverstripe”
Did you ever wonder how to enable 3rd party plugins (or so called “frameworks“) within the great compass toolset managed by assetic in your edgy symfony 2.1 project?
(If there is more extensive documentation available concerning assetic + CompassFilter, please stop reading on and let me know!)
If you take a look at the filter class itself (it is CompassFilter in the generic Assetic\Filter namespace), you should recognise several option values that you can use in your application wide config.yml file.
But first you have to install the framework plugin following these instructions.
Continue reading “[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework”
Ever wanted to create a Google XML Image Sitemap?
This is how it could be done with PHP: Continue reading “Create Google XML (Image) Sitemaps in PHP”
Actually i was a fan of YAML regarding the configuration files of Symfony2.
This was probably because i was used to it since symfony 1.4 and i also thought its better readable.
Its partly still true, but my Netbeans Editor has some problems with using @ in YAML and this breaks my highlighting.
So the better readability vanished to nirvana.
So i checked out XML configuration. Its also widely used by the community.
Pros and Cons (mostly Pros) you can read in this post by Fabien.
Continue reading “Symfony2 from YAML to XML configuration”
Symfony2 has a great Caching Layer based on its HTTP Cache. But this aims mainly on caching the views.
In some apps however you need to cache data behind the scenes, f.e. responses from API calls or custom objects sets.
Symfony2 itself doesnt have such a functionality on first sight (symfony2 doesnt, but Doctrine, see below) and so I searched for one and first found a bundle which utilize the Zend Cache lib:
This worked well but as discussed here(https://github.com/KnpLabs/KnpZendCacheBundle/issues/2) this adds dependencies to your Symfony2 project. This is actually not necessary since Doctrine/Commons is almost always part of your Symfony2 distribution and the Doctrine/Commons provides a Cache Layer as well.
A very good one, indeed.
So if you need to cache data use Doctrine/Commons.
Continue reading “Caching Data in Symfony2”
When you start with symfony you probably use the Symfony Standard Edition.
This is a quite good start but there are somethings that helped me and might help you aswell.
Since every beginning is “schwer” :)
So here there are.
Continue reading “Symfony2 Starter Tweaks”