Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • CakePHP find conditions

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 635
    Comment on it

    Find is the  data-retrieval functions in cakephp.

    Below is the list of CakePHP find conditions :-

    Name Default Description
       type   'first' it can be 'all', 'first', or 'list' by default it is first.
    conditions   null array containing the find (select) conditions as key/value pairs
     fields  null it specify which fields should be fetch from database.
     order   null it will sort data using sql 'order by conditions either in ASC DSC
     page  null page number, used for paged data.
     limit  null it will limit the number of records to be fetch.
     recursive   1 this is cakephp recursive value.

     

    Below is CakePHP find condition example:-

     

     

    
    $this->User->find('all'),array(
      'conditions' => array('Model.field' => $thisValue), //array of conditions
      'recursive' => 1, //int
      'fields' => array('Model.field1', 'DISTINCT Model.field2'), //array of field names
      'order' => array('Model.created', 'Model.field3 DESC'), //string or array defining order
      'group' => array('Model.field'), //fields to GROUP BY
      'limit' => n, //int
      'page' => n, //int
      'offset'=>n, //int   
     
    )

    $this->User->find() :- in this line User is our model name.

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: