1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dynamic\Foxy\Orders\Model; |
4
|
|
|
|
5
|
|
|
use SilverStripe\CMS\Model\SiteTree; |
6
|
|
|
use SilverStripe\ORM\DataObject; |
7
|
|
|
use SilverStripe\ORM\FieldType\DBCurrency; |
8
|
|
|
use SilverStripe\ORM\HasManyList; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class OrderDetail |
12
|
|
|
* @package Dynamic\Foxy\Orders\Model |
13
|
|
|
* |
14
|
|
|
* @property int $Quantity |
15
|
|
|
* @property DBCurrency $Price |
16
|
|
|
* @property string $ProductName |
17
|
|
|
* @property string $ProductCode |
18
|
|
|
* @property string $ProductImage |
19
|
|
|
* @property string $ProductCategory |
20
|
|
|
* @property int $ProductID |
21
|
|
|
* @property int $OrderID |
22
|
|
|
* |
23
|
|
|
* @method SiteTree Product |
24
|
|
|
* @method Order Order |
25
|
|
|
* |
26
|
|
|
* @method HasManyList OrderOptions |
27
|
|
|
*/ |
28
|
|
|
class OrderDetail extends DataObject |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* @var array |
32
|
|
|
*/ |
33
|
|
|
private static $db = [ |
|
|
|
|
34
|
|
|
'Quantity' => 'Int', |
35
|
|
|
'Price' => 'Currency', |
36
|
|
|
'ProductName' => 'Varchar(255)', |
37
|
|
|
'ProductCode' => 'Varchar(100)', |
38
|
|
|
'ProductImage' => 'Text', |
39
|
|
|
'ProductCategory' => 'Varchar(100)', |
40
|
|
|
]; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var array |
44
|
|
|
*/ |
45
|
|
|
private static $has_one = [ |
|
|
|
|
46
|
|
|
'Product' => SiteTree::class, |
47
|
|
|
'Order' => Order::class, |
48
|
|
|
]; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var array |
52
|
|
|
*/ |
53
|
|
|
private static $has_many = [ |
|
|
|
|
54
|
|
|
'OrderOptions' => OrderOption::class, |
55
|
|
|
]; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var array |
59
|
|
|
*/ |
60
|
|
|
private static $summary_fields = [ |
|
|
|
|
61
|
|
|
'Product.Title', |
62
|
|
|
'Quantity', |
63
|
|
|
'Price.Nice', |
64
|
|
|
]; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var string |
68
|
|
|
*/ |
69
|
|
|
private static $table_name = 'FoxyOrderDetail'; |
|
|
|
|
70
|
|
|
} |
71
|
|
|
|