Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions code_samples/api/commerce/src/Command/OrderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public function __construct(
parent::__construct();
}

public function configure(): void
{
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$currentUser = $this->userService->loadUserByLogin('admin');
Expand Down
4 changes: 0 additions & 4 deletions code_samples/api/commerce/src/Command/PaymentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ public function __construct(
parent::__construct();
}

public function configure(): void
{
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$currentUser = $this->userService->loadUserByLogin('admin');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ public function __construct(
parent::__construct();
}

public function configure(): void
{
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$user = $this->userService->loadUserByLogin('admin');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ public function __construct(
parent::__construct();
}

public function configure(): void
{
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$user = $this->userService->loadUserByLogin('admin');
Expand Down
10 changes: 5 additions & 5 deletions docs/commerce/order_management/order_management_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To get orders and manage them, use the [`Ibexa\Contracts\OrderManagement\OrderSe
To access a single order by using its string identifier, use the [`OrderServiceInterface::getOrderByIdentifier`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-OrderServiceInterface.html#method_getOrderByIdentifier) method:

``` php
[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 52, 55, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 48, 51, remove_indent=True) =]]
```

Use the returned [`OrderInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-Value-Order-OrderInterface.html) value object to access details about the order.
Expand All @@ -31,7 +31,7 @@ See the [Discounts API](discounts_api.md#retrieve-applied-discounts) to learn ho
To access a single order by using its numerical ID, use the [`OrderServiceInterface::getOrder`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-OrderServiceInterface.html#method_getOrder) method:

``` php
[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 58, 61, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 54, 57, remove_indent=True) =]]
```

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

// ...
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 110, 119) =]]
[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 106, 115) =]]
```

## Create order

To create an order, use the [`OrderServiceInterface::createOrder`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-OrderServiceInterface.html#method_createOrder) method and provide it with the [`Ibexa\Contracts\OrderManagement\Value\Struct\OrderCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-Value-Struct-OrderCreateStruct.html) object that contains a list of products, purchased quantities, product, total prices, and tax amounts.

``` php
[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 92, 102, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 88, 98, remove_indent=True) =]]
```

## Update order
Expand All @@ -61,5 +61,5 @@ You could do it to support a scenario when, for example, the order is processed
To update order information, use the [`OrderServiceInterface::updateOrder`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-OrderServiceInterface.html#method_updateOrder) method:

``` php
[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 105, 108, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 101, 104, remove_indent=True) =]]
```
4 changes: 2 additions & 2 deletions docs/commerce/payment/extend_payment.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ When you create a payment, you can attach custom data to it, for example, you ca
You add custom data by using the `setContext` method:

``` php
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 82, 93, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 78, 89, remove_indent=True) =]]
```

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

``` php
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 55, 58, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 51, 54, remove_indent=True) =]]
```
12 changes: 6 additions & 6 deletions docs/commerce/payment/payment_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ You can change that by providing a custom payment identifier in `Ibexa\Contracts
To access a single payment by using its numerical ID, use the `PaymentServiceInterface::getPayment` method:

``` php
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 49, 52, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 45, 48, remove_indent=True) =]]
```

### Get single payment by identifier

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

``` php
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 55, 56, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 51, 52, remove_indent=True) =]]
```

## Get multiple payments
Expand All @@ -34,15 +34,15 @@ To fetch multiple payments, use the `PaymentServiceInterface::findPayments` meth
It follows the same search query pattern as other APIs:

``` php
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 64, 79, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 60, 75, remove_indent=True) =]]
```

## Create payment

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`.

``` php
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 82, 95, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 78, 91, remove_indent=True) =]]
```

## Update payment
Expand All @@ -53,13 +53,13 @@ The `Ibexa\Contracts\Payment\Payment\PaymentUpdateStruct` object takes the follo
To update payment information, use the `PaymentServiceInterface::updatePayment` method:

``` php
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 98, 103, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 94, 99, remove_indent=True) =]]
```

## Delete payment

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

``` php
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 106, 106, remove_indent=True) =]]
[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 102, 102, remove_indent=True) =]]
```
8 changes: 4 additions & 4 deletions docs/content_management/content_api/managing_content.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,19 @@ To get a list of events for a specified time period, use the `CalendarServiceInt
You need to provide the method with an EventQuery, which takes a date range and a count as the minimum of parameters:

``` php
[[= include_code('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 38, 48, remove_indent=True) =]]
[[= include_code('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 34, 44, remove_indent=True) =]]
```

You can also get the first and last event in the list by using the `first()` and `last()` methods of an `EventCollection` (`Ibexa\Contracts\Calendar\EventCollection`):

``` php
[[= include_code('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 50, 51, remove_indent=True) =]]
[[= include_code('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 46, 47, remove_indent=True) =]]
```

You can process the events in a collection using the `find(Closure $predicate)`, `filter(Closure $predicate)`, `map(Closure $callback)` or `slice(int $offset, ?int $length = null)` methods of `EventCollection`, for example:

``` php
[[= include_code('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 53, 56, remove_indent=True) =]]
[[= include_code('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 49, 52, remove_indent=True) =]]
```

### Performing calendar actions
Expand All @@ -237,5 +237,5 @@ You must pass an `Ibexa\Contracts\Calendar\EventAction\EventActionContext` insta
`EventActionContext` defines events on which the action is performed, and action-specific parameters, for example, a new date:

``` php
[[= include_code('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 58, 61, remove_indent=True) =]]
[[= include_code('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 54, 57, remove_indent=True) =]]
```
10 changes: 5 additions & 5 deletions docs/product_catalog/product_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,25 +255,25 @@ To get information about product attribute groups, use the [`AttributeGroupServi
`AttributeGroupServiceInterface::findAttributeGroups()` gets attribute groups, all of them or filtered with an optional [`AttributeGroupQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-AttributeGroup-AttributeGroupQuery.html) object:

``` php
[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 54, 54, remove_indent=True) =]]
[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 50, 50, remove_indent=True) =]]

[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 75, 79, remove_indent=True) =]]
[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 71, 75, remove_indent=True) =]]
```

To create an attribute group, use `LocalAttributeGroupServiceinterface::createAttributeGroup()` and provide it with an [`AttributeGroupCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Local-Values-AttributeGroup-AttributeGroupCreateStruct.html):

``` php
[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 49, 52, remove_indent=True) =]]
[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 45, 48, remove_indent=True) =]]
```

To get information about product attributes, use the [`AttributeDefinitionServiceInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html), or [`LocalAttributeDefinitionServiceInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Local-LocalAttributeDefinitionServiceInterface.html) to modify attributes.

``` php
[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 61, 62, remove_indent=True) =]]
[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 57, 58, remove_indent=True) =]]
```

To create an attribute, use `LocalAttributeGroupServiceinterface::createAttributeDefinition()` and provide it with an [`AttributeDefinitionCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Local-Values-AttributeDefinition-AttributeDefinitionCreateStruct.html):

``` php
[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 66, 71, remove_indent=True) =]]
[[= include_code('code_samples/api/product_catalog/src/Command/AttributeCommand.php', 62, 67, remove_indent=True) =]]
```
Loading