/
ShopSize.php
61 lines (55 loc) · 1.34 KB
/
ShopSize.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
<?php
App::uses('ShopAppModel', 'Shop.Model');
/**
* ShopSize Model
*
* @property ShopProduct $ShopProduct
*/
class ShopSize extends ShopAppModel {
/**
* belongsTo relations
*
* @var array
*/
public $belongsTo = array(
'ShopProduct' => array(
'className' => 'Shop.ShopProduct',
'foreignKey' => 'foreign_key'
)
);
/**
* overload construct to translate validation messages
*
* @param type $id
* @param type $table
* @param type $ds
*/
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
foreach ($this->schema() as $field => $config) {
if (strstr($field, 'shipping') === false && strstr($field, 'product') === false) {
continue;
}
$this->validate[$field] = array(
);
}
}
/**
* Get the fields for finds
*
* @return array
*/
public function findFields($alias = null) {
return array(
$this->fullFieldName($this->primaryKey, $alias),
$this->fullFieldName('product_width', $alias),
$this->fullFieldName('product_height', $alias),
$this->fullFieldName('product_length', $alias),
$this->fullFieldName('shipping_width', $alias),
$this->fullFieldName('shipping_height', $alias),
$this->fullFieldName('shipping_length', $alias),
$this->fullFieldName('product_weight', $alias),
$this->fullFieldName('shipping_weight', $alias)
);
}
}