@@ -8,14 +8,13 @@ The class `ZGetWeek` contains only code, that configures the API of your SAP
8
8
9
9
* ` getName() ` returns the SAP remote function name.
10
10
* ` setDate() ` sets the SAP remote function parameter.
11
- * ` getReturnTypecast ()` casts the result of the SAP remote function call to a
11
+ * ` invoke ()` casts the result of the SAP remote function call to a
12
12
DateTime object.
13
13
14
14
``` php
15
15
<?php
16
16
17
17
use phpsap\saprfc\AbstractRemoteFunctionCall;
18
- use kbATeam\TypeCast\TypeCastValue;
19
18
use phpsap\DateTime\SapDateTime;
20
19
21
20
/**
@@ -46,14 +45,19 @@ class ZGetWeek extends AbstractRemoteFunctionCall
46
45
}
47
46
48
47
/**
49
- * Define typecasting for SAP remote function return value.
50
- * @return \kbATeam\TypeCast\TypeCastValue
48
+ * Call SAP remote function to get the week of the given date.
49
+ * @param null|array $params Optional parameter array.
50
+ * @return phpsap\DateTime\SapDateTime The calendar week of the given date.
51
+ * @throws \phpsap\interfaces\exceptions\IConnectionFailedException
52
+ * @throws \phpsap\interfaces\exceptions\IUnknownFunctionException
53
+ * @throws \phpsap\exceptions\FunctionCallException
51
54
*/
52
- protected function getReturnTypecast( )
55
+ protected function invoke($params = null )
53
56
{
54
- return new TypeCastValue(function ($result) {
55
- return SapDateTime::createFromFormat(SapDateTime::SAP_WEEK, $result['E_WEEK']);
56
- });
57
+ //parent returns array
58
+ $result = parent::invoke($params);
59
+ //return SapDateTime object
60
+ return SapDateTime::createFromFormat(SapDateTime::SAP_WEEK, $result['E_WEEK']);
57
61
}
58
62
}
59
63
```
0 commit comments