#5636: Code to point out invalid parameters for the model's find method (ie 
typos)
------------------------+---------------------------------------------------
    Reporter:  ZoeB     |          Type:  Enhancement
      Status:  new      |      Priority:  Low        
   Milestone:  1.2.x.x  |     Component:  Model      
     Version:           |      Severity:  Trivial    
    Keywords:           |   Php_version:  n/a        
Cake_version:           |  
------------------------+---------------------------------------------------
 I have a knack of entering typos for various parameters when using the
 model's find method, so I've written some code that looks out for them and
 points them out to the user, providing the system's in debug mode.  It
 fits quite nicely in line 1747 of an (admittedly possibly quite old now)
 version of /cake/libs/model/model.php that I have.  Specifically, it goes
 right after this line:


 {{{
 list($type, $query) = array($conditions, $fields);
 }}}


 Here's my proposed update:


 {{{
 if (Configure::read('debug') > 0) {
         foreach ($query as $param => $ignore) {
                 switch ($param) {
                         case 'conditions':
                         case 'recursive':
                         case 'fields':
                         case 'order':
                         case 'group':
                         case 'limit':
                         case 'page':
                                 break;

                         default:
                                 echo "Error: {$param} is an invalid find
 parameter";
                 }
         }
 }
 }}}


 Presumably something better than "echo" can be used, and the whole thing
 should be indented four tabs, but you get the idea.


 I hope this helps someone,[[BR]]
 Zoe.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5636>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to