05.25 php saved
dardosordi
Tags add more
 
Note
example model validating the title
  1. <?php
  2.  
  3. class Post extends AppModel {
  4.  
  5.     var $name = 'Post';
  6.     var $belongsTo = array (
  7.         'User' => array()
  8.     );
  9.     var $validate = array(
  10.         'title' => array(
  11.              'rule' => array( 'minLength' , 8 ),
  12.                 'allowEmpty' => false,
  13.                 'message' => 'You must enter a post title!',
  14.                 'required' => true
  15.             )
  16.     );
  17.  
  18.  
  19. }
  20.  
  21. ?>
Parsed in 0.036 seconds, using GeSHi 1.0.7.14

Modify this Paste