File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 31
31
or
32
32
` composer require php-sap/saprfc-kralik `
33
33
34
+ ** ATTENTION** :
35
+ Starting with PHP 8 and ` php-sap/interfaces ` 5.0.0 the function instance is
36
+ created using the factory method ` SapRfc::create() ` .
37
+ Before that it was ` new SapRfc() ` .
38
+
34
39
``` php
35
40
<?php
36
41
//Include the composer autoloader ...
@@ -48,7 +53,7 @@ use phpsap\saprfc\SapRfc;
48
53
*
49
54
* In this case the configuration array is defined manually.
50
55
*/
51
- $result = (new SapRfc(
56
+ $result = SapRfc::create (
52
57
'MY_COOL_SAP_REMOTE_FUNCTION',
53
58
[
54
59
'IV_DATE' => (new DateTime('2019-12-31'))
@@ -61,7 +66,7 @@ $result = (new SapRfc(
61
66
ConfigTypeA::JSON_USER => 'username',
62
67
ConfigTypeA::JSON_PASSWD => 'password'
63
68
])
64
- )) ->invoke();
69
+ )->invoke();
65
70
//The output array contains a DateTime object.
66
71
echo $result['OV_DATE']->format('Y-m-d') . PHP_EOL;
67
72
```
Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ therefore be stored as JSON by using `json_encode` on the `SapRfc` instance.
22
22
23
23
Let's start with an example.
24
24
25
+ ** ATTENTION** :
26
+ Starting with PHP 8 and ` php-sap/interfaces ` 5.0.0 the function instance is
27
+ created using the factory method ` SapRfc::create() ` .
28
+ Before that it was ` new SapRfc() ` .
29
+
25
30
``` php
26
31
<?php
27
32
use phpsap\classes\Config\ConfigTypeA;
@@ -31,7 +36,7 @@ use phpsap\saprfc\SapRfc;
31
36
* The imaginary SAP remote function requires a
32
37
* date as input and will return a date as output.
33
38
*/
34
- $function = new SapRfc('MY_COOL_SAP_REMOTE_FUNCTION');
39
+ $function = SapRfc::create ('MY_COOL_SAP_REMOTE_FUNCTION');
35
40
/**
36
41
* The instance in `$function` has no way to establish a connection
37
42
* because it lacks the necessary configuration. Let's add that
You can’t perform that action at this time.
0 commit comments