1 | <?php |
||
21 | class DatabaseStorage extends BaseObject implements StorageInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var string Name of the user component |
||
25 | */ |
||
26 | public $userComponent = 'user'; |
||
27 | |||
28 | /** |
||
29 | * @var string Name of the database component |
||
30 | */ |
||
31 | public $dbComponent = 'db'; |
||
32 | |||
33 | /** |
||
34 | * @var string Name of the cart table |
||
35 | */ |
||
36 | public $table = '{{%cart}}'; |
||
37 | |||
38 | /** |
||
39 | * @var string Name of the |
||
40 | */ |
||
41 | public $idField = 'sessionId'; |
||
42 | |||
43 | /** |
||
44 | * @var string Name of the field holding serialized session data |
||
45 | */ |
||
46 | public $dataField = 'cartData'; |
||
47 | |||
48 | /** |
||
49 | * @var bool If set to true, empty cart entries will be deleted |
||
50 | */ |
||
51 | public $deleteIfEmpty = false; |
||
52 | |||
53 | /** |
||
54 | * @var Connection |
||
55 | */ |
||
56 | private $_db; |
||
57 | |||
58 | /** |
||
59 | * @var User |
||
60 | */ |
||
61 | private $_user; |
||
62 | |||
63 | /** |
||
64 | * @inheritdoc |
||
65 | */ |
||
66 | public function init() |
||
80 | |||
81 | /** |
||
82 | * @param Cart $cart |
||
83 | * |
||
84 | * @return mixed |
||
85 | */ |
||
86 | public function load(Cart $cart) |
||
102 | |||
103 | /** |
||
104 | * @param int $default |
||
105 | * |
||
106 | * @return int |
||
107 | */ |
||
108 | protected function getIdentifier($default) |
||
118 | |||
119 | /** |
||
120 | * @param \yii2mod\cart\Cart $cart |
||
121 | */ |
||
122 | public function save(Cart $cart) |
||
147 | |||
148 | /** |
||
149 | * Assigns cart to logged in user |
||
150 | * |
||
151 | * @param $sourceId |
||
152 | * @param $destinationId |
||
153 | */ |
||
154 | public function reassign($sourceId, $destinationId) |
||
162 | } |
||
163 |