Optionable Behavior / 03.19.2010

» Leia este post em português aqui.

The Optionable Behavior is a CakePHP behavior that tries to bring something from schemaless databases to RDBMS databases like MySQL. With it, you can add as much extra fields as you need to a table without touching the DB design / schema.

» Read more


» Leia este post em português aqui.

Hey guys!

Here is a simple function that helps me to sort elements in a MySQL database by it’s ID’s:

If that is usefull to you, let me know!


Sluggable Behavior / 10.06.2009

» Leia este post em português aqui.

On the web, “slug” is a short text used in a URL to identify and describe a resource. As Mariano Iglesias’ Sluggable Behavior decription says:

This is particularly useful to create SEO links out of, for example, a table of articles. Instead of seeing those ugly /articles/view/4 URLs, use the Sluggable Behavior and easily accept URLs such as /articles/view/my-seo-friendly-article. It handles the slug creation, slug collision, and allows you to specify different settings such as the separator to use, maximum width of a slug, among other useful parameters.

My Sluggable Behavior is a simpler version of Mariano Iglesias’ Sluggable Behavior with a few add-ons. It’s basically the same thing but instead of implementing all the slug logic on the behavior, it just uses Cake’s Inflector::slug() method. With CakePHP 1.3, this method is really powerful and flexible.

» Read more


» Read this post in english here.

A um tempo atras escrevi este artigo que falava sobre como filtrar uma consulta com associações HABTM no CakePHP. O artigo já tem mais de um ano e nem está mais aqui. Muita coisa já mudou.

Na verdade, na época a coisa já havia mudado, mas eu não sabia. Foi quando eu encontrei este outro artigo aqui. O artigo ensina como fazer joins em casos específicos utilizando o Model::find().

» Read more