-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Cart.php
133 lines (113 loc) · 2.47 KB
/
Cart.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
namespace Extcode\Cart\Domain\Model;
/*
* This file is part of the package extcode/cart.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
use Extcode\Cart\Domain\Model\Order\Item;
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
class Cart extends AbstractEntity
{
/**
* @var string
*/
protected $fHash = '';
/**
* @var string
*/
protected $sHash = '';
/**
* @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
protected $feUser = null;
/**
* @var \Extcode\Cart\Domain\Model\Order\Item
*/
protected $orderItem = null;
/**
* @var string
*/
protected $cart = null;
/**
* @var bool
*/
protected $wasOrdered = false;
public function __construct()
{
$this->fHash = bin2hex(openssl_random_pseudo_bytes(32));
$this->sHash = bin2hex(openssl_random_pseudo_bytes(32));
}
/**
* @return string
*/
public function getFHash(): string
{
return $this->fHash;
}
/**
* @return string
*/
public function getSHash(): string
{
return $this->sHash;
}
/**
* @return FrontendUser|null
*/
public function getFeUser(): ?FrontendUser
{
return $this->feUser;
}
/**
* @param FrontendUser $feUser
*/
public function setFeUser(FrontendUser $feUser)
{
$this->feUser = $feUser;
}
/**
* @return Item|null
*/
public function getOrderItem(): ?Item
{
return $this->orderItem;
}
/**
* @param Item $orderItem
*/
public function setOrderItem(Item $orderItem)
{
$this->orderItem = $orderItem;
}
/**
* @return \Extcode\Cart\Domain\Model\Cart\Cart|null
*/
public function getCart(): ?\Extcode\Cart\Domain\Model\Cart\Cart
{
return unserialize($this->cart);
}
/**
* @param \Extcode\Cart\Domain\Model\Cart\Cart $cart
*/
public function setCart(\Extcode\Cart\Domain\Model\Cart\Cart $cart)
{
$this->cart = serialize($cart);
}
/**
* @return bool
*/
public function getWasOrdered(): bool
{
return $this->wasOrdered;
}
/**
* @param bool $wasOrdered
*/
public function setWasOrdered(bool $wasOrdered)
{
$this->wasOrdered = $wasOrdered;
}
}