Symfony: Design patterns and sfContext good practice
Hi everyone,
I wanted to share with you some relevant information about Symfony. Over the past few weeks, I’ve been working on a Symfony project and I had to learn more deeply Symfony framework.
The first thing I learned is what exactly is inside Symfony. Then I found this blog post: http://obvioushints.blogspot.com/2008/12/symfony-design-patterns.html
This article is very interesting because you will discover many design patterns: ones you already know (MVC, Front Controller, …) and ones you probably don’t (Intercepting Filter, Command, Active Record). That will help you understand how symfony is working.
The second thing is a bug that I had when I was about to send my website to production: “The default context does not exist”. That’s how I found this article: http://webmozarts.com/2009/07/01/why-sfcontextgetinstance-is-bad/
You’ll learn when and why you should use sfContext or not ? There are bad practices you should avoid if you don’t want flexibility and testability problems.
Alright, I hope it helped you as much as it helped me !