Day 13: Tags ============ Previously on symfony --------------------- The askeet application can serve data trough a web page, a RSS feed, or email. Questions can be asked and answered. But the organization of questions is still to be developed. Organizing questions in categories and subcategories could end up in an inextricable tree structure, with thousands of branches and no easy way to know in which sub-branch a question you are looking for may be. However, web 2.0 applications have come out with a new way of organizing items: tags. Tags are words, just as categories are. But the differences are that there is no hierarchy of tags, and that an item can have several tags. While finding a cat with categories could prove cumbersome (animal/mammal/four-legged/feline/, or other mysterious category names), it is very simple with tags (pet+cute). Add to that the ability for all users to add tags to a given question, and you get the famous concept of [folksonomy][1]. Guess what? That's exactly what we are going to do with the askeet questions. It will take us some time (today and tomorrow), but the result is worth the pain. It will also be the occasion to show how to do complex SQL requests to a database using a Creole connection. Let's go. The `QuestionTag` class ----------------------- There are several ways to implement tags. We chose to add a `QuestionTag` table with the following structure:  When a user tags a question, it creates a new record in the `question_tag` table, linked to both the `user` table and the `question` table. There are two versions of the tag recorded: The one entered by the user, and a normalized version (all lower case, without any special character) used for indexing. ### Schema update As usual, adding a table to a symfony project is done by appending its Propel definition to the `schema.xml` file: [xml] ...