Subversion Repositories SmartDukaan

Rev

Rev 13695 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13532 anikendra 1
<?php
2
App::uses('AppModel', 'Model');
3
/**
4
 * Category Model
5
 *
6
 * @property Product $Product
7
 */
8
class Category extends AppModel {
9
	public $actsAs = array('Tree');
10
 
11
/**
12
 * Display field
13
 *
14
 * @var string
15
 */
16
	public $displayField = 'name';
17
 
18
/**
19
 * Validation rules
20
 *
21
 * @var array
22
 */
23
	public $validate = array(
24
		'name' => array(
25
			'notEmpty' => array(
26
				'rule' => array('notEmpty'),
27
				//'message' => 'Your custom message here',
28
				//'allowEmpty' => false,
29
				//'required' => false,
30
				//'last' => false, // Stop validation after this rule
31
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
32
			),
33
		),
34
		'parent_id' => array(
35
			'numeric' => array(
36
				'rule' => array('numeric'),
37
				//'message' => 'Your custom message here',
38
				//'allowEmpty' => false,
39
				//'required' => false,
40
				//'last' => false, // Stop validation after this rule
41
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
42
			),
43
		),
44
		'lft' => array(
45
			'numeric' => array(
46
				'rule' => array('numeric'),
47
				//'message' => 'Your custom message here',
48
				//'allowEmpty' => false,
49
				//'required' => false,
50
				//'last' => false, // Stop validation after this rule
51
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
52
			),
53
		),
54
		'rght' => array(
55
			'numeric' => array(
56
				'rule' => array('numeric'),
57
				//'message' => 'Your custom message here',
58
				//'allowEmpty' => false,
59
				//'required' => false,
60
				//'last' => false, // Stop validation after this rule
61
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
62
			),
63
		),
64
	);
65
 
66
	//The Associations below have been created with all possible keys, those that are not needed can be removed
67
 
68
/**
69
 * hasMany associations
70
 *
71
 * @var array
72
 */
73
	public $hasMany = array(
74
		'Product' => array(
75
			'className' => 'Product',
76
			'foreignKey' => 'category_id',
77
			'dependent' => false,
78
			'conditions' => '',
79
			'fields' => '',
80
			'order' => '',
81
			'limit' => '',
82
			'offset' => '',
83
			'exclusive' => '',
84
			'finderQuery' => '',
85
			'counterQuery' => ''
13695 anikendra 86
		),
87
		'Brand' => array(
88
			'className' => 'Brand',
89
			'foreignKey' => 'category_id',
90
			'dependent' => false,
91
			'conditions' => '',
92
			'fields' => '',
13759 anikendra 93
			'order' => array('name'=>'asc'),
13695 anikendra 94
			'limit' => '',
95
			'offset' => '',
96
			'exclusive' => '',
97
			'finderQuery' => '',
98
			'counterQuery' => ''
13532 anikendra 99
		)
100
	);
101
 
102
}