The “default” context does not exist.

Is there any symfony developer out there who never stumbled upon this dreadful error message? I doubt it. Recently, a lot of posts have been made on the user mailing list asking for explanations and fixes. A quick search on Google for the exact phrase even returns 480 results!

The reason for this error is quite simple though: It’s because you used sfContext::getInstance(). And you should never do that. Read the rest of this entry »

Written by: | 22 Comments | Category: Best Practices

Unit testing is a very important task of professional, scalable software development. Many tools exist to support unit testing in one or another way. All tools come with advantages and drawbacks. One of the best known test frameworks in the PHP world is PHPUnit. With the release of symfony, Fabien Potencier released another new testing framework for PHP: lime. The biggest advantage of lime over PHPUnit surely is the conciseness of the written test code. There are several disadvantages as well, which include bad test encapsulation due to the lack of support for fixture setup and teardown, and missing support for mock object generation.

Today I will briefly speak about the advantages of both frameworks, and how they can be combined to result in a slicker, powerful testing framework. I will show you how easy testing really can be! And you will be able to try it out, because all the required code has already been released in sfLimeExtraPlugin.

Read the rest of this entry »

Written by: | 18 Comments | Category: Development

Hi! A warm welcome to Web Mozarts also from my side. It took some time to write my first post, but here it is!

Your app is slow? If the symfony web debug toolbar doesn’t give you the details you want, you can take a real deep look into your application using the profiling options of Xdebug.

In this tutorial we will set up Xdebug to profile your application and then we’ll analyse the output with KCachegrind.

By the way: Xdebug has a lot of other useful features. One that comes automatically is the nicely formated php debugging output in case of errors including the full call stack. KCachegrind on the other hand has very interesting graphical output features like the call graph. In the case of symfony the call graph can be like an interesting expedition into the functionality of the framework.

Read the rest of this entry »

Written by: | 5 Comments | Category: Tips & Tricks

Keeping all parts of a website consistent is one of the most time consuming tasks of a web designer. Spending this time is worth doing, because the more consistent the look and feel of your website is, the more professional it appears to its users.

I will show you today how symfony could help you keeping all of your forms consistent with very little work left for you to do. Read the rest of this entry »

Written by: | 14 Comments | Category: Thinking Ahead

Today I want to follow up on my last post about improving the forms in symfony. David Hermann wrote a quite interesting reply on his blog. I want to take some of his ideas and enhance them even further. The goal is to be able to reuse as much code as possible when creating applications with lots of different forms.

This post will be different though. While I only made assumptions in my last post without any code verifying that my ideas are implementable, I do have a prototype implementation now. Read the rest of this entry »

Written by: | 8 Comments | Category: Thinking Ahead

After my last post about simplifying symfony and especially the forms framework, I started diving into the forms framework to find out how we could improve it. I tried to find ways to improve the usability of this framework without reducing its mighty possibilities. Quite the contrary, I think that the forms can be made even mightier than they are now. Read the rest of this entry »

Written by: | 18 Comments | Category: Thinking Ahead

Welcome to all of you on! Whether you are a PHP developer, a symfony power user or just getting started in object-oriented web application development – this blog is for you.

With our first post, I want to talk about symfony and where this blog is heading. And I don’t mean “symphony” as in music – no! Scrap that “ph”. It’s “symfony”, one of the greatest web frameworks that has been developed in PHP5 so far. (If you ever dare to write symfony with “ph”, tiny kittens will suffer!)

Symfony is by a large part a product of Fabien Potencier’s ingenuity and dedication. I want to deeply express my respect for his work at this point. The framework is a very well-thought piece of work and can immensely boost your productivity.

The amount of features and the complexity come with a drawback though: It takes a lot of time to learn how to develop efficiently with symfony. Many PHP developers are overwhelmed by the object-oriented concepts applied in the framework. Many call for a simplified version and I must agree that symfony suffers some usability problems lately. But why is that and how can we improve the current situation? Read the rest of this entry »

Written by: | 13 Comments | Category: Thinking Ahead

Additional Resources