.
Felix Geisendorfer's Blog: Making error handling for Model::save more beautiful in CakePHP
In a new post to his blog today, Felix Geisendorfer shares a method to make error handling in the CakePHP model functionality a bit more beautiful. Now I've written actions like the one above in the past as well. It's just that I've not had many MySql errors since I've switched to CakePHP. The Model class usually handles all the DB operations flawlessly and it's probably been over a year that I've written a custom MySql statement in my code somewhere. However, even CakePHP or, what's more likely, the database can fail or deny operations.He shows some code snippets of what he sees as less beautiful versions of database insertion code, methods that either don't check the response/errors or make a messy job of it. His solution works by returning the result into a switch statement to check the results and handling it there (versus a series of ifs). There's a class you'll need to make it work (Common), but he shows how to use it and creates a simple add example with it and a new Controller to handle the request.
Read the full story
 

( back to top )
LEAR Web Design | LEAR Corporation | How LEAR Corp Works | Welcome To My Site | Learn PHP
South Florida Web Design | Broward Web Design | Miami-Dade Web Design | Palm Beach Web Design
Coral Springs Web Design | Deerfield Beach Web Design | Fort Lauderdale Web Design | Hollywood Web Design | Pompano Beach Web Design | Weston Web Design
Boca Raton Web Design | Boynton Beach Web Design | Delray Beach Web Design | Lantana Web Design | West Palm Beach Web Design
Aventura Web Design | Bal Harbour Web Design | North Miami Beach Web Design | North Miami Web Design | Miami Web Design | South Beach Miami Web Design
Atlanta | Boston Web Design | New York Web Design | Philadelphia Web Design | Pittsburgh
Los Angeles | San Diego | San Francisco | Sacramento | San Jose | Santa Clara | Mountain View | Sunnyvale
Appleton | Eau Claire | Green Bay | Milwaukee | Sturgeon Bay | Wausau | Denver

Copyright © 2003-2007 LEAR Web Design.
A South Florida Web Design Firm | SEO Consultant