Skip to content

Commit f9f605c

Browse files
committed
replace remote function instance creation according to interfaces v5
1 parent 1f00cb9 commit f9f605c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Diff for: index.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ or
3131
or
3232
`composer require php-sap/saprfc-kralik`
3333

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+
3439
```php
3540
<?php
3641
//Include the composer autoloader ...
@@ -48,7 +53,7 @@ use phpsap\saprfc\SapRfc;
4853
*
4954
* In this case the configuration array is defined manually.
5055
*/
51-
$result = (new SapRfc(
56+
$result = SapRfc::create(
5257
'MY_COOL_SAP_REMOTE_FUNCTION',
5358
[
5459
'IV_DATE' => (new DateTime('2019-12-31'))
@@ -61,7 +66,7 @@ $result = (new SapRfc(
6166
ConfigTypeA::JSON_USER => 'username',
6267
ConfigTypeA::JSON_PASSWD => 'password'
6368
])
64-
))->invoke();
69+
)->invoke();
6570
//The output array contains a DateTime object.
6671
echo $result['OV_DATE']->format('Y-m-d') . PHP_EOL;
6772
```

Diff for: saprfc-function.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ therefore be stored as JSON by using `json_encode` on the `SapRfc` instance.
2222

2323
Let's start with an example.
2424

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+
2530
```php
2631
<?php
2732
use phpsap\classes\Config\ConfigTypeA;
@@ -31,7 +36,7 @@ use phpsap\saprfc\SapRfc;
3136
* The imaginary SAP remote function requires a
3237
* date as input and will return a date as output.
3338
*/
34-
$function = new SapRfc('MY_COOL_SAP_REMOTE_FUNCTION');
39+
$function = SapRfc::create('MY_COOL_SAP_REMOTE_FUNCTION');
3540
/**
3641
* The instance in `$function` has no way to establish a connection
3742
* because it lacks the necessary configuration. Let's add that

0 commit comments

Comments
 (0)