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

Symfony2, PhpBB4 and Drupal8

The last week I attended Drupal Latino conference. It was an interesting experience and I met really nice people, however a question arose in my head after attend the first session about Drupal architecture. They started talking about Drupal 7. I’m not pretty much informed about the Drupal releases and its features, but I thought they would say something like Drupal 7 will be based on a new generation framework. They said nothing… Read More »Symfony2, PhpBB4 and Drupal8

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

Yii framework

The last week I have started a new project that requires to learn a new framework. This new framework is Yii, as it home page says: “The Fast, Secure and Professional PHP Framework”. Some time ago I have worked with Zend Framework and Code Igniter and, as someone said sometime, there is no better framework, there is just a set of tools that should be used wisely for the right job. Yii, was developed and is… Read More »Yii framework

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

Propel2 and Doctrine2: Together but not scrambled

Eleven days ago, the core team from the Propel Project was discussing about its future. Some thought that this meeting was just to give a final “rest in peace” to Propel, however they could not be more wrong. Propel is more alive than ever!. Many years ago, in the beginnings of 2008, I met a framework, it was our beloved symfony framework, and with it, I met a great ORM (you can guess), it was Propel.… Read More »Propel2 and Doctrine2: Together but not scrambled

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

Nice urls with symfony

Usually when working with symfony, when the time comes to deploy the application, one problem arises, the urls. While developing a normal url could be: Two elements are not welcome here: index.php and web/ Index.php/ To get rid of index.php a setting must be configure in the settings.yml file from the config folder:   prod: .settings: no_script_name: true   Now after cleaning the cache the annoying index.php is gone. Note: Just an application can have this setting… Read More »Nice urls with symfony