Posts Tagged ‘cakephp’

CakePHP Query Method Does Support Bind Parameters

Just came across a post from a few months ago where I stated that CakePhp doesn’t support bind parameters. I have learned since then that this is not true. Happily, it does support bind parameters. An example I have used successfully: function query_bottom_count($bottom_value, $start_uts, $end_uts) { $sql = <<<XSQL SELECT REPLACE( SUBSTRING_INDEX( SUBSTRING_INDEX( last_result_url, '://', [...]

Advance Model Testing in CakePhp

One of the most challenging issues I’ve found in developing with CakePhp is unit testing. Testing models, with its dependence on fixtures, is especially touchy. The documentation, while constantly improving, still seems at crucial points incomplete or inconsistent. In this post, I’d like to draw attention to a few pitfalls that I burned a few [...]

Project Cakewell

Project Cakewell is a CakePhp prototype application. Its main purpose is to document and demonstrate useful concepts and features of a web application built with the CakePhp framework. These include things like unit testing a component, creating a working fixture , and configuring your application to automatically detect the server environment and set the debug [...]

Dynamic Validation Error Messages in CakePhp

Problem In CakePhp, I want to invalidate a field submitted in a form and set the error message dynamically. If the error message is set by a validation parameter within the model, the new message should override that error message and be displayed by the form in the view. Overview Consider the following three cases [...]

CakePhp: Custom Pagination Methods

I wanted to use the CakePhp pagination helper to paginate some complex records. The model that the paginator was referencing had both belongsTo and hasMany associations. belongsTo associations are not a problem. hasMany, I discovered, are — which makes sense when I think about. As the ticket notes: You can only paginate LEFT JOIN tables [...]