|
Revision 846, 1.3 kB
(checked in by aarkerio, 4 weeks ago)
|
|
Models extended
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * Chipotle Software 2002-2008 GPLv3 |
|---|
| 4 | * @version 0.3 |
|---|
| 5 | **/ |
|---|
| 6 | |
|---|
| 7 | class Share extends AppModel { |
|---|
| 8 | |
|---|
| 9 | public $belongsTo = array('User' => |
|---|
| 10 | array('className' => 'User', |
|---|
| 11 | 'conditions' => '', |
|---|
| 12 | 'order' => '', |
|---|
| 13 | 'fields' =>'id, username', |
|---|
| 14 | 'foreignKey' => 'user_id' |
|---|
| 15 | ), |
|---|
| 16 | 'Subject' => |
|---|
| 17 | array('className' => 'Subject', |
|---|
| 18 | 'conditions' => '', |
|---|
| 19 | 'order' => null, |
|---|
| 20 | 'foreignKey' => 'subject_id' |
|---|
| 21 | ) |
|---|
| 22 | ); |
|---|
| 23 | |
|---|
| 24 | public $validate = array( |
|---|
| 25 | 'file' => array( |
|---|
| 26 | 'rule' => array('minLength', 4), |
|---|
| 27 | 'message' => 'File must be at least four characters long', |
|---|
| 28 | 'allowEmpty' => false, |
|---|
| 29 | 'required' => true |
|---|
| 30 | ), |
|---|
| 31 | 'description' => array( |
|---|
| 32 | 'rule' => array('minLength', 8), |
|---|
| 33 | 'message' => 'Description must be at least 8 characters long', |
|---|
| 34 | 'allowEmpty' => false, |
|---|
| 35 | 'required' => true |
|---|
| 36 | ), |
|---|
| 37 | 'user_id' => array( |
|---|
| 38 | 'rule' => 'numeric', |
|---|
| 39 | 'allowEmpty' => false, |
|---|
| 40 | 'on' => 'create', // but not on update |
|---|
| 41 | 'required' => true |
|---|
| 42 | ) |
|---|
| 43 | ); |
|---|
| 44 | |
|---|
| 45 | } |
|---|
| 46 | ?> |
|---|