News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SaniSoft Blog:
unbindModel() and paginate() gotcha in CakePHP 1.2
March 06, 2008 @ 12:59:00

Tarique Sani has pointed out a little "gotcha" he came across when working in his CakePHP application a while back, specifically with the unbindModel and paginate methods.

A small note to myself regarding a gotcha which I ran into today morning with the built in unbindModel method which lets you disassociate model relations on the fly.

He sets up a situation where his model works correctly in one case but reverts back to the bindings it started with in another. He provides a way around it - an optional parameter that forces the CakePHP framework to treat things correctly.

0 comments voice your opinion now!
cakephp framework unbindmodel paginate


The Bakery:
An improvement to unbindModel on model side
December 14, 2006 @ 07:56:00

The Bakery has a new CakePHP tip posted today showing how to improve the unbindModel handling on the model side of things (versus in the controller as mentioned previously).

The problem with that solution is that it requires you to change the way you define your model relations. [...] Rather try to change your code to suit your needs, and let CakePHP do what it does best: act as a framework.

The technique approaches the associations differently - loaded and called when you make the call to expects() versus just automatically. They include the code to make it all work for an extension to the Model (AppModel), and extension to the AppModel (Title), and finally the TitlesController that shows the deliberate calls to expects to pull in the models.

0 comments voice your opinion now!
improvement unbindmodel model controller expect load improvement unbindmodel model controller expect load


The Bakery:
Keeping bindModel and unbindModel out of your Controllers
December 08, 2006 @ 13:53:15

On the Bakery (the CakePHP site), there's a new entry talking about how to keep bindModel and unbindModel (create/destroy associations) out of your Controller and banishing them back to where they belong.

Here I show you how to add a simple method to your Model classes that allows your controllers to specify binds directly, in a cleaner, more proper way.

They start with a simple modification to the AppModel class before implementing the associations in another class, Title, extending the new and improved AppModel. They follow with with a clean, bindModel-free Controller that sets values and reads from the associated model data.

0 comments voice your opinion now!
cakephp framework bindmodel unbindmodel model controller cakephp framework bindmodel unbindmodel model controller



Community Events





Don't see your event here?
Let us know!


deployment package zendserver tips install library unittest framework community series opinion bugfix api release podcast laravel symfony language interview introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework