forked from croogo/croogo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvocabulary.php
89 lines (86 loc) · 1.6 KB
/
vocabulary.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/**
* Vocabulary
*
* PHP version 5
*
* @category Model
* @package Croogo
* @version 1.0
* @author Fahad Ibnay Heylaal <[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @link http://www.croogo.org
*/
class Vocabulary extends AppModel {
/**
* Model name
*
* @var string
* @access public
*/
public $name = 'Vocabulary';
/**
* Behaviors used by the Model
*
* @var array
* @access public
*/
public $actsAs = array(
'Ordered' => array(
'field' => 'weight',
'foreign_key' => false,
),
'Cached' => array(
'prefix' => array(
'vocabulary_',
'croogo_vocabulary_',
'croogo_vocabularies_',
),
),
);
/**
* Validation
*
* @var array
* @access public
*/
public $validate = array(
'title' => array(
'rule' => array('minLength', 1),
'message' => 'Title cannot be empty.',
),
'alias' => array(
'isUnique' => array(
'rule' => 'isUnique',
'message' => 'This alias has already been taken.',
),
'minLength' => array(
'rule' => array('minLength', 1),
'message' => 'Alias cannot be empty.',
),
),
);
/**
* Model associations: hasAndBelongsToMany
*
* @var array
* @access public
*/
public $hasAndBelongsToMany = array(
'Type' => array(
'className' => 'Type',
'joinTable' => 'types_vocabularies',
'foreignKey' => 'vocabulary_id',
'associationForeignKey' => 'type_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => '',
),
);
}