1 <?php
2
3 /* --------------------------------------------------------------
4 OrderObjectService.inc.php 2015-11-03 gm
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2015 Gambio GmbH
8 Released under the GNU General Public License (Version 2)
9 [http://www.gnu.org/licenses/gpl-2.0.html]
10 --------------------------------------------------------------
11 */
12
13 MainFactory::load_class('OrderObjectServiceInterface');
14
15 /**
16 * Class OrderObjectService
17 *
18 * @category System
19 * @package Order
20 */
21 class OrderObjectService implements OrderObjectServiceInterface
22 {
23 /**
24 * @var OrderItemFactoryInterface
25 */
26 protected $orderItemFactory;
27
28 /**
29 * @var OrderItemAttributeFactoryInterface
30 */
31 protected $orderItemAttributeFactory;
32
33 /**
34 * @var OrderItemPropertyFactoryInterface
35 */
36 protected $orderItemPropertyFactory;
37
38 /**
39 * @var OrderTotalFactoryInterface
40 */
41 protected $orderTotalFactory;
42
43
44 /**
45 * OrderObjectService Constructor
46 *
47 * @param \OrderItemFactoryInterface $orderItemFactory
48 * @param \OrderItemAttributeFactoryInterface $orderItemAttributeFactory
49 * @param \OrderItemAttributeFactoryInterface $orderItemPropertyFactory
50 * @param \OrderTotalFactoryInterface $orderTotalFactory
51 */
52 public function __construct(OrderItemFactoryInterface $orderItemFactory,
53 OrderItemAttributeFactoryInterface $orderItemAttributeFactory,
54 OrderItemAttributeFactoryInterface $orderItemPropertyFactory,
55 OrderTotalFactoryInterface $orderTotalFactory)
56 {
57 $this->orderItemFactory = $orderItemFactory;
58 $this->orderItemAttributeFactory = $orderItemAttributeFactory;
59 $this->orderItemPropertyFactory = $orderItemPropertyFactory;
60 $this->orderTotalFactory = $orderTotalFactory;
61 }
62
63
64 /**
65 * Create Order Item Object
66 *
67 * Creates and returns an order item object.
68 *
69 * @param StringType $name Name of the order item object to be created.
70 *
71 * @return \OrderItemInterface
72 */
73 public function createOrderItemObject(StringType $name)
74 {
75 return $this->orderItemFactory->createOrderItem($name);
76 }
77
78
79 /**
80 * Create Order Item Attribute Object
81 *
82 * Creates and returns an order item attribute object.
83 *
84 * @param StringType $name Name of the order item object attribute to be created.
85 * @param StringType $value Value of the order item object attribute to be created.
86 *
87 * @return \OrderItemAttributeInterface
88 */
89 public function createOrderItemAttributeObject(StringType $name, StringType $value)
90 {
91 return $this->orderItemAttributeFactory->createOrderItemAttribute($name, $value);
92 }
93
94
95 /**
96 * Create Order Item Property Object
97 *
98 * Creates and returns an order item property object.
99 *
100 * @param StringType $name Name of the order item object property to be created.
101 * @param StringType $value Value of the orreturn $this->orderItemAttributeFactory->createOrderItemAttribute($name,
102 * $value);der item object property to be created.
103 *
104 * @return \OrderItemPropertyInterface
105 */
106 public function createOrderItemPropertyObject(StringType $name, StringType $value)
107 {
108 return $this->orderItemPropertyFactory->createOrderItemAttribute($name, $value);
109 }
110
111
112 /**
113 * Create Order Total Object
114 *
115 * Creates and returns an order total object.
116 *
117 * @param StringType $title Title of the order total to be created.
118 * @param DecimalType $value value of the order total to be created.
119 * @param StringType $valueText Value text of the order total to be created.
120 * @param StringType $class Class of the order total to be created.
121 * @param IntType $sortOrder Sort order of the order total to be created.
122 *
123 * @return \OrderTotalInterface
124 */
125 public function createOrderTotalObject(StringType $title,
126 DecimalType $value,
127 StringType $valueText = null,
128 StringType $class = null,
129 IntType $sortOrder = null)
130 {
131 return $this->orderTotalFactory->createOrderTotal($title, $value, $valueText, $class, $sortOrder);
132 }
133
134
135 /**
136 * Create Stored Order Item Object
137 *
138 * Creates and returns a stored order item object.
139 *
140 * @param \IdType $orderItemId Order item id of the order item to be stored.
141 *
142 * @return \StoredOrderItemInterface
143 */
144 public function createStoredOrderItemObject(IdType $orderItemId)
145 {
146 return $this->orderItemFactory->createStoredOrderItem($orderItemId);
147 }
148
149
150 /**
151 * Create Stored Order Item Attribute Object
152 *
153 * Creates and returns a stored order item attribute object.
154 *
155 * @param \IdType $orderItemAttributeId Order item attribute id of the order item attribute to be stored.
156 *
157 * @return \StoredOrderItemAttributeInterface
158 */
159 public function createStoredOrderItemAttributeObject(IdType $orderItemAttributeId)
160 {
161 return $this->orderItemAttributeFactory->createStoredOrderItemAttribute($orderItemAttributeId);
162 }
163
164
165 /**
166 * Create Stored Order Item Property Object
167 *
168 * Creates and returns a stored order item property object.
169 *
170 * @param \IdType $orderItemPropertyId Order property id of the order item property to be stored.
171 *
172 * @return \StoredOrderItemPropertyInterface
173 */
174 public function createStoredOrderItemPropertyObject(IdType $orderItemPropertyId)
175 {
176 return $this->orderItemPropertyFactory->createStoredOrderItemAttribute($orderItemPropertyId);
177 }
178
179
180 /**
181 * Create Stored Order Total Object
182 *
183 * Creates and returns a stored order total object.
184 *
185 * @param \IdType $orderTotalId Order total id of the order total to be stored.
186 *
187 * @return \StoredOrderTotalInterface
188 */
189 public function createStoredOrderTotalObject(IdType $orderTotalId)
190 {
191 $this->orderTotalFactory->createStoredOrderTotal($orderTotalId);
192 }
193 }
194