Posts By: Mikael Ohlsson

Enable Twig Extentions in Symfony2

Twig extentions is included by default in the vendors but to enable one of them like the Text (to be able to use nl2br) add the following to your app/config/config.yml services: twig.extension.txt: class: Twig_Extensions_Extension_Text tags: – { name: twig.extension }

Virtual Host and Symfony2

It is always good to set up a virtual host for your project when you are developing an application. Here is an example of two virtual hosts that I have set up for two of my projects. One called crm and one called blog and both projects are located under /Users/sfprojects/ This is what I… Read more »

Symfony2 and .gitignore

*Updated 29th october 2012* Here are the settings i use for my .gitignore in a symfony project. Generic ignores: ## generic files to ignore *~ *.lock *.DS_Store *.swp *.out IDE files are personal and not interesting for other people: ## IDE files to ignore nbproject/ .idea/ *.tmproj Symfony specific ignore files: # Symfony files to… Read more »

Installing Symfony2

Here is a small video of how to install Symfony2 with git version control. My first video tutorial in years and I mumble a bit but I hope someone likes it ;). [youtube=http://www.youtube.com/watch?v=j-PJe2jDl8I&w=500&h=385] The following commands where used: To install the vendors use php bin/vendors install Clear the cache and the logs rm -rf app/cache/*… Read more »

Symfony2 and Timestampable example

To add Timestampable behaviour you need to add DoctrineExtentions to your app see my previous post┬áSymfony2 and DoctrineExtensions for information of how to do that. You need to add the following in the top of the Entity use Gedmo\Mapping\Annotation as Gedmo; and then you can use it like this in your entity: /** * @var… Read more »