Skip to content

Commit b5e691a

Browse files
committed
Code samples fixes
1 parent f4f74f9 commit b5e691a

File tree

13 files changed

+79
-89
lines changed

13 files changed

+79
-89
lines changed

docs/administration/dashboard/php_api_dashboard_service.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ Using the `admin` account, it loads the group members, logs each one in, creates
2424
First argument is the `Content ID` of the dashboard to copy.
2525
Following arguments are the Content IDs of the user groups.
2626

27-
``` php hl_lines="61"
27+
``` php hl_lines="63"
2828
[[= include_file('code_samples/back_office/dashboard/src/Command/DashboardCommand.php') =]]
2929
```
3030

3131
The following line runs the command with `74` as the model dashboard's Content ID, `13` the user group's Content ID, and on the SiteAccess `admin` to have the right `user_content_type_identifier` config:
3232

3333
```bash
3434
php bin/console doc:dashboard 74 13 --siteaccess=admin
35-
```
35+
```

docs/ai_actions/extend_ai_actions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For example, you can create a handler that connects to a translation model and u
1515
You can execute AI Actions by using the [ActionServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionServiceInterface.html) service, as in the following example:
1616

1717
``` php
18-
[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 102, 121) =]]
18+
[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 105, 124) =]]
1919
```
2020

2121
The `GenerateAltTextAction` is a built-in action that implements the [ActionInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html), takes an [Image](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-DataType-Image.html) as an input, and generates the alternative text in the response.
@@ -44,7 +44,7 @@ You can influence the execution of an Action with two events:
4444
Below you can find the full example of a Symfony Command, together with a matching service definition.
4545
The command finds the images modified in the last 24 hours, and adds the alternative text to them if it's missing.
4646

47-
``` php hl_lines="88 101-126"
47+
``` php hl_lines="91 104-129"
4848
[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php') =]]
4949
```
5050

@@ -78,7 +78,7 @@ See [Action Configuration Search Criteria reference](action_configuration_criter
7878
The following example creates a new Action Configuration:
7979

8080
``` php hl_lines="3 17"
81-
[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 59, 76) =]]
81+
[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 62, 79) =]]
8282
```
8383

8484
Actions Configurations are tied to a specific Action Type and are translatable.
@@ -89,7 +89,7 @@ Reuse existing Action Configurations to simplify the execution of AI Actions.
8989
You can pass one directly to the `ActionServiceInterface::execute()` method:
9090

9191
``` php hl_lines="7-8"
92-
[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 77, 85) =]]
92+
[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 80, 88) =]]
9393
```
9494

9595
The passed Action Configuration is only taken into account if the Action Context was not passed to the Action directly using the [ActionInterface::setActionContext()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html#method_hasActionContext) method.

docs/commerce/order_management/order_management_api.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ To get orders and manage them, use the `Ibexa\Contracts\OrderManagement\OrderSer
1818
To access a single order by using its string identifier, use the `OrderService::getOrderByIdentifier` method:
1919

2020
``` php
21-
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 57, 61) =]]
21+
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 61, 65) =]]
2222
```
2323

2424
### Get single order by ID
2525

2626
To access a single order by using its numerical ID, use the `OrderService::getOrder` method:
2727

2828
``` php
29-
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 63, 67) =]]
29+
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 68, 72) =]]
3030
```
3131

3232
## Get multiple orders
@@ -38,15 +38,15 @@ It follows the same search query pattern as other APIs:
3838
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 8, 9) =]][[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 10, 14) =]]
3939

4040
// ...
41-
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 116, 125) =]]
41+
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 120, 130) =]]
4242
```
4343

4444
## Create order
4545

4646
To create an order, use the `OrderService::createOrder` method and provide it with the `Ibexa\Contracts\OrderManagement\Value\OrderCreateStruct` object that contains a list of products, purchased quantities, product, total prices, and tax amounts.
4747

4848
``` php
49-
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 97, 108) =]]
49+
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 101, 113) =]]
5050
```
5151

5252
## Update order
@@ -56,5 +56,5 @@ You could do it to support a scenario when, for example, the order is processed
5656
To update order information, use the `OrderService::updateOrder` method:
5757

5858
``` php
59-
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 110, 114) =]]
59+
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 114, 119) =]]
6060
```

docs/commerce/payment/extend_payment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ When you create a payment, you can attach custom data to it, for example, you ca
9494
You add custom data by using the `setContext` method:
9595

9696
``` php
97-
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 89, 101) =]]
97+
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 96, 108) =]]
9898
```
9999

100100
Then, you retrieve it with the `getContext` method:
101101

102102
``` php
103-
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 66, 69) =]]
103+
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 70, 75) =]]
104104
```

docs/commerce/payment/payment_api.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ You can change that by providing a custom payment identifier in `Ibexa\Contracts
1717
To access a single payment by using its numerical ID, use the `PaymentServiceInterface::getPayment` method:
1818

1919
``` php
20-
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 60, 64) =]]
20+
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 64, 68) =]]
2121
```
2222

2323
### Get single payment by identifier
2424

2525
To access a single payment by using its string identifier, use the `PaymentServiceInterface::getPaymentByIdentifier` method:
2626

2727
``` php
28-
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 66, 70) =]]
28+
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 70, 74) =]]
2929
```
3030

3131
## Get multiple payments
@@ -34,16 +34,16 @@ To fetch multiple payments, use the `PaymentServiceInterface::findPayments` meth
3434
It follows the same search query pattern as other APIs:
3535

3636
``` php
37-
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 72, 88) =]]
37+
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 78, 94) =]]
3838
```
3939

4040
## Create payment
4141

4242
To create a payment, use the `PaymentServiceInterface::createPayment` method and provide it with the `Ibexa\Contracts\Payment\Payment\PaymentCreateStruct` object that takes the following arguments: `method`, `order` and `amount`.
4343

4444
``` php
45-
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 94, 94) =]]
46-
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 101, 104) =]]
45+
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 100, 104) =]]
46+
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 107, 111) =]]
4747
```
4848

4949
## Update payment
@@ -54,13 +54,13 @@ The `Ibexa\Contracts\Payment\Payment\PaymentUpdateStruct` object takes the follo
5454
To update payment information, use the `PaymentServiceInterface::updatePayment` method:
5555

5656
``` php
57-
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 106, 112) =]]
57+
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 112, 118) =]]
5858
```
5959

6060
## Delete payment
6161

6262
To delete a payment from the system, use the `PaymentServiceInterface::deletePayment` method:
6363

6464
``` php
65-
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 114, 115) =]]
65+
[[= include_file('code_samples/api/commerce/src/Command/PaymentCommand.php', 120, 121) =]]
6666
```

docs/commerce/payment/payment_method_api.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ From the developer's perspective, payment methods are referenced with identifier
2626
To access a single payment method by using its string identifier, use the `PaymentMethodService::getPaymentMethodByIdentifier` method:
2727

2828
``` php
29-
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 52, 56) =]]
29+
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 56, 60) =]]
3030
```
3131

3232
### Get single payment method by ID
3333

3434
To access a single payment method by using its numerical ID, use the `PaymentMethodService::getPaymentMethod` method:
3535

3636
``` php
37-
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 46, 50) =]]
37+
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 50, 54) =]]
3838
```
3939

4040
## Get multiple payment methods
@@ -44,7 +44,7 @@ To fetch multiple payment methods, use the `PaymentMethodService::findPaymentMet
4444
It follows the same search query pattern as other APIs:
4545

4646
``` php
47-
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 58, 75) =]]
47+
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 62, 79) =]]
4848
```
4949

5050
## Create payment method
@@ -59,7 +59,7 @@ To create a payment method, use the `PaymentMethodService::createPaymentMethod`
5959
- `options` object.
6060

6161
``` php
62-
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 58, 59) =]][[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 77, 87) =]]
62+
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 62, 63) =]][[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 81, 91) =]]
6363
```
6464

6565
## Update payment method
@@ -70,20 +70,20 @@ An `Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodUpdateStruct` object can
7070
To update payment method information, use the `PaymentMethodServiceInterface::updatePaymentMethod` method:
7171

7272
``` php
73-
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 89, 99) =]]
73+
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 93, 103) =]]
7474
```
7575

7676
## Delete payment method
7777

7878
To delete a payment method from the system, use the `PaymentMethodService::deletePayment` method:
7979
``` php
80-
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 101, 107) =]]
80+
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 105, 111) =]]
8181
```
8282

8383
## Check whether payment method is used
8484

8585
To check whether a payment method is used, for example, before you delete it, use the `PaymentMethodService::isPaymentMethodUsed` method:
8686

8787
``` php
88-
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 109, 122) =]]
89-
```
88+
[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 113, 126) =]]
89+
```

docs/commerce/shipping_management/shipment_api.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ From the developer's perspective, shipments are referenced with a UUID identifie
1616
To access a single shipment by using its string identifier, use the `ShipmentService::getShipmentByIdentifier` method:
1717

1818
``` php
19-
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 69, 78) =]]
19+
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 73, 82) =]]
2020
```
2121

2222
### Get single shipment by id
2323

2424
To access a single shipment by using its numerical id, use the `ShipmentService::getShipment` method:
2525

2626
``` php
27-
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 57, 67) =]]
27+
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 61, 71) =]]
2828
```
2929

3030
## Get multiple shipments
@@ -33,15 +33,15 @@ To fetch multiple shipments, use the `ShipmentService::findShipments` method.
3333
It follows the same search query pattern as other APIs:
3434

3535
``` php
36-
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 80, 99) =]]
36+
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 84, 103) =]]
3737
```
3838

3939
## Create shipment
4040

4141
To create a shipment, use the `ShipmentService::createShipment` method and provide it with an `Ibexa\Contracts\Shipping\Value\ShipmentCreateStruct` object that takes two parameters, a `shippingMethod` string and a `Money` object.
4242

4343
``` php
44-
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 101, 115) =]]
44+
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 105, 119) =]]
4545
```
4646

4747
## Update shipment
@@ -51,13 +51,13 @@ You could do it to support a scenario when, for example, the shipment is process
5151
To update shipment information, use the `ShipmentService::updateShipment` method:
5252

5353
``` php
54-
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 117, 128) =]]
54+
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 121, 132) =]]
5555
```
5656
## Delete shipment
5757

5858
To delete a shipment from the system, use the `ShipmentService::deleteShipment` method:
5959

6060

6161
``` php
62-
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 130, 131) =]]
62+
[[= include_file('code_samples/api/commerce/src/Command/ShipmentCommand.php', 134, 135) =]]
6363
```

docs/commerce/shipping_management/shipping_method_api.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To access a shipping method by using its identifier, use the `ShippingMethodServ
1717
The method takes a string as `$identifier` parameter and uses a prioritized language from SiteAccess settings unless you pass another language as `forcedLanguage`.
1818

1919
``` php
20-
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 61, 71) =]]
20+
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 65, 75) =]]
2121
```
2222

2323
### Get shipping method by ID
@@ -26,7 +26,7 @@ To access a shipping method by using its ID, use the `ShippingMethodServiceInter
2626
The method takes a string as `$id` parameter and uses a prioritized language from SiteAccess settings unless you pass another language as `forcedLanguage`.
2727

2828
``` php
29-
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 49, 59) =]]
29+
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 53, 63) =]]
3030
```
3131

3232
## Get multiple shipping methods
@@ -35,37 +35,37 @@ To fetch multiple shipping methods, use the `ShippingMethodServiceInterface::get
3535
It follows the same search query pattern as other APIs:
3636

3737
``` php
38-
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 73, 91) =]]
38+
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 77, 95) =]]
3939
```
4040

4141
## Create shipping method
4242

4343
To create a shipping method, use the `ShippingMethodServiceInterface::createShippingMethod` method and provide it with the `Ibexa\Contracts\Shipping\Value\ShippingMethodCreateStruct` object that you created by using the `newShippingMethodCreateStruct` method.
4444

4545
``` php
46-
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 92, 116) =]]
46+
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 97, 120) =]]
4747
```
4848

4949
## Update shipping method
5050

5151
To update a shipping method, use the `ShippingMethodServiceInterface::updateShippingMethod` method and provide it with the `Ibexa\Contracts\Shipping\Value\ShippingMethodUpdateStruct` object that you created by using the `newShippingMethodUpdateStruct` method.
5252

5353
``` php
54-
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 118, 133) =]]
54+
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 122, 137) =]]
5555
```
5656

5757
## Delete shipping method
5858

5959
To update a shipping method, use the `ShippingMethodServiceInterface::deleteShippingMethod` method.
6060

6161
``` php
62-
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 134, 140) =]]
62+
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 138, 144) =]]
6363
```
6464

6565
## Delete shipping method translation
6666

6767
To delete shipping method translation, use the `ShippingMethodServiceInterface::deleteShippingMethodTranslation` method.
6868

6969
``` php
70-
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 142, 151) =]]
70+
[[= include_file('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 146, 155) =]]
7171
```

0 commit comments

Comments
 (0)