-
-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathCart.php
More file actions
94 lines (72 loc) · 1.86 KB
/
Cart.php
File metadata and controls
94 lines (72 loc) · 1.86 KB
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
<?php
declare(strict_types=1);
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\DomainObject\AbstractEntity;
class Cart extends AbstractEntity
{
protected string $fHash = '';
protected string $sHash = '';
protected ?FrontendUser $feUser = null;
protected ?Item $orderItem = null;
protected ?string $serializedCart = null;
protected bool $wasOrdered = false;
public function __construct()
{
$this->fHash = bin2hex(openssl_random_pseudo_bytes(32));
$this->sHash = bin2hex(openssl_random_pseudo_bytes(32));
}
public function getFHash(): string
{
return $this->fHash;
}
public function getSHash(): string
{
return $this->sHash;
}
public function getFeUser(): ?FrontendUser
{
return $this->feUser;
}
public function setFeUser(FrontendUser $feUser): void
{
$this->feUser = $feUser;
}
public function getOrderItem(): ?Item
{
return $this->orderItem;
}
public function setOrderItem(Item $orderItem): void
{
$this->orderItem = $orderItem;
}
public function getCart(): ?Cart\Cart
{
return unserialize($this->serializedCart);
}
public function setCart(Cart\Cart $cart): void
{
$this->serializedCart = serialize($cart);
}
/**
* @deprecated
*/
public function getWasOrdered(): bool
{
return $this->wasOrdered();
}
public function wasOrdered(): bool
{
return $this->wasOrdered;
}
public function setWasOrdered(bool $wasOrdered): void
{
$this->wasOrdered = $wasOrdered;
}
}