Technical

Integrating Doctrine: Symfony vs Yii

Continuing with Symfony vs Yii series, in this post will be show how to integrate the best PHP ORM into our project. The versions that will be used are: Yii 1.1.5, Symfony 1.4.8 and Doctrine 1.2.3 . First it will be show the steps to properly integrate Doctrine with Yii, which has no native connection, but there is a very useful plugin (doctrine-yii) to do so. Then the same but with Symfony, which will be a very straight… Read More »Integrating Doctrine: Symfony vs Yii

Autoloading: Symfony vs Yii

PHP Autoloading consists about including files in an automated manner, using the __autoload magic function which is automatically called if there is a class or a interface that hasn’t been defined yet. This is the recommended aproach instead of using a long list of includes at the beginning of each file. Both symfony 1 and Yii implement autoloading to avoid you the annoyances of requiring files by hand. Let’s see how each one implements it for you:… Read More »Autoloading: Symfony vs Yii

Passing parameters from the action to the view: Symfony vs Yii

This is the first post in the Symfony vs Yii series, that compare common functionalities between Symfony 1 and Yii, specifycally symfony 1.4.8 and Yii 1.1.5. In the Model View Controller pattern, the controller needs to send information to the view, to be properly displayed to the user. This information is send in form of variables. Then, this time I will show how to pass custom variables from the controller (Yii) or action (symfony) to… Read More »Passing parameters from the action to the view: Symfony vs Yii

Adding custom information to your Doctrine schema

Sometime ago I needed to add some custom information to each of my Doctrine 1 tables in a schema. It was for  an interesting and time saving functionality I will describe in a future post. For now I’m going to describe how to add and then retrieve custom data to each schema model. First let’s see an example schema:   Post: tableName: post columns: id: { type: integer , length: 20 ,… Read More »Adding custom information to your Doctrine schema

Symfony genUrl method

Symfony genUrl is one of the most used methods on symfony 1 series (I’m not sure if it is called the same way in Symfony 2). But what is special about this method? Well, it is the one which generates urls for the whole framework. It is the man when you want to generate urls where to link to. That is its main purpose. Indeed, a lot of methods you usually used called… Read More »Symfony genUrl method

Circular table relations in a symfony project

Circular relations in the database occur when a foreign key of one table is included in a separate table, whilst at the same time a further foreign key is located in the first table. Usually this is not desirable because it can produce many problems when making queries or inserting data. However sometimes it can improve performance. For example we could have a model like: There is a client that… Read More »Circular table relations in a symfony project

Colorize your Windows console life with symfony

For many years, Windows and symfony users have been neglected the right to see stylish colors in their life, or at least in their command line. However the use of colors has some importance, for example when running tests. Differentiating the red tests from the green ones, let us easily see where the errors are quickly. By using symfony 1.3/1.4 and making some configurations the dark past is over. Here ANSICON comes to the rescue, allowing Windows to understand ANSI… Read More »Colorize your Windows console life with symfony