File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131or
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.
6671echo $result['OV_DATE']->format('Y-m-d') . PHP_EOL;
6772```
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.
2222
2323Let'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
2732use 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
You can’t perform that action at this time.
0 commit comments