Bindable now Containable Behavior in CakePHP Core

Behold! One of the coolest behaviors "Bindable" is now included in CakePHP's core. Many thanks to Mariano and Felix for their efforts and including this in CakePHP's core as "Containable" behavior. I have found this behavior to be the most useful by far. I remember the nightmares I used to forgo in controlling model bindings in CakePHP 1.1, specially when coding DustJacketReview. We had to pull up so much data for a single page that we were forced to write custom queries to make it as light weight as possible. But ever since I shifted to CakePHP 1.2, things got a lot better. I have to admit that I had to find some workarounds for some situations when working with CakePHP 1.1 and specially for multiple Ajax paging within a single page. But now these nightmares are over!

Although one thing I am still concerned about is the built in pagination. It's brilliant no doubt but still I can't control the model bindings when paginating any model. I observed the code and found out that it instantiates a new instance of the model when paginating it, so even if I set the bindings to persistent, it has no effect as they are not persistent with the new object. Anyhow, a post on this matter is in the pipeline, I still need some more information to actually formally voice the issue on cake's trac. Currently I have a workaround that's working really good for me. Let's just say that I wanted more than "paginate" function to be specified within a model, and I got it ;)

One Response to “Bindable now Containable Behavior in CakePHP Core”

  1. SayB  on June 19th, 2008

    Ok it turns out that my Cake version had some errors due to which I wasn’t able to control my model bindings. Using the new RC1, I can control the bindings easily. Cool!


Leave a Reply