Changeset 699 for trunk/app/models

Show
Ignore:
Timestamp:
08/06/08 17:10:36 (4 months ago)
Author:
aarkerio
Message:

New validate arrays

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/models/glossary.php

    r535 r699  
    88class Glossary extends AppModel 
    99{ 
    10     // Its always good practice to include this variable. 
    11     public $name        = 'Glossary'; 
     10  // Its always good practice to include this variable. 
     11  public $name        = 'Glossary'; 
    1212      
    13    public $belongsTo  = array( 
     13  public $belongsTo  = array( 
    1414             "User" => array( 
    1515                        "className" => "User" 
     
    2121     
    2222    public $validate = array( 
    23       'item'           => VALID_NOT_EMPTY,         //'/[a-z0-9\_\-]{3,}$/i', 
    24       'user_id'        => VALID_NOT_EMPTY, 
    25         'catglossary_id' => VALID_NOT_EMPTY, 
    26       'definition'     => VALID_NOT_EMPTY 
     23                 'item'           => array('rule'       => array('minLength', 3), 
     24                                                       'required'   => true, 
     25                               'message'    => 'Item at least three characters', 
     26                                                       'allowEmpty' => false 
     27                                                       ), 
     28                 'definition'           => array('rule' => array('minLength', 10), 
     29                                                       'required'   => true, 
     30                               'message'    => 'Definition least ten characters', 
     31                                                       'allowEmpty' => false 
     32                                                       ), 
     33                             'catglossary_id'           => array('rule' => array('minLength', 1), 
     34                                                       'required'   => true, 
     35                               'message'    => 'Catglossary can not be empty', 
     36                                                       'allowEmpty' => false 
     37                                                       ) 
    2738   ); 
    28 /* 
    29 public $validate = array( 
    30         'login' => array('alphanumeric' => array( 
    31                                                  'rule' => 'alphaNumeric', 
    32                                              'required' => true, 
    33                                                          'message' => 'Alphabets and numbers only' 
    34                                    ), 
    35                                 'between' => array( 
    36                                            'rule' => array('between', 5, 15), 
    37                                                                                'message' => 'Between 5 to 15 characters' 
    38                                            ) 
    39                                 ), 
    40                        'password' => array( 
    41                                    'rule' => array('minLength', '8'), 
    42                                                                'message' => 'Mimimum 8 characters long' 
    43                                    ), 
    44                        'email' => 'email', 
    45                        'born' => array( 
    46                                'rule' => 'date', 
    47                                'message' => 'Enter a valid date', 
    48                                                            'allowEmpty' => true 
    49                                ) 
    50                        ); */ 
    5139} 
    52  
    5340?>