@@ 235-246 (lines=12) @@ | ||
232 | ||
233 | $key = rtrim($key, ' and '); |
|
234 | if ($srcClass === 'Customer') { |
|
235 | if ($navigationPropName === 'Orders') { |
|
236 | $query = "SELECT * FROM Orders WHERE CustomerID = '$sourceEntityInstance->CustomerID' and $key"; |
|
237 | $stmt = sqlsrv_query($this->_connectionHandle, $query); |
|
238 | if ($stmt === false) { |
|
239 | $errorAsString = self::_getSQLSRVError(); |
|
240 | throw ODataException::createInternalServerError($errorAsString); |
|
241 | } |
|
242 | ||
243 | $result = $this->_serializeOrders($stmt); |
|
244 | } else { |
|
245 | die('Customer does not have navigation porperty with name: ' . $navigationPropName); |
|
246 | } |
|
247 | } else if ($srcClass === 'Order') { |
|
248 | if ($navigationPropName === 'Order_Details') { |
|
249 | $query = "SELECT * FROM [Order Details] WHERE OrderID = $sourceEntityInstance->OrderID"; |
|
@@ 247-260 (lines=14) @@ | ||
244 | } else { |
|
245 | die('Customer does not have navigation porperty with name: ' . $navigationPropName); |
|
246 | } |
|
247 | } else if ($srcClass === 'Order') { |
|
248 | if ($navigationPropName === 'Order_Details') { |
|
249 | $query = "SELECT * FROM [Order Details] WHERE OrderID = $sourceEntityInstance->OrderID"; |
|
250 | $stmt = sqlsrv_query($this->_connectionHandle, $query); |
|
251 | if ($stmt === false) { |
|
252 | $errorAsString = self::_getSQLSRVError(); |
|
253 | throw ODataException::createInternalServerError($errorAsString); |
|
254 | } |
|
255 | ||
256 | $result = $this->_serializeOrderDetails($stmt); |
|
257 | } else { |
|
258 | die('Order does not have navigation porperty with name: ' . $navigationPropName); |
|
259 | } |
|
260 | } |
|
261 | ||
262 | return empty($result) ? null : $result[0]; |
|
263 |