Skip to content

Commit a7286bd

Browse files
committed
Merge remote-tracking branch 'origin/master' into search-page
2 parents 558509e + 0e84cc9 commit a7286bd

File tree

919 files changed

+87493
-47965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

919 files changed

+87493
-47965
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
| ------------- | ---
33
| JIRA Ticket | <!-- URLs to GitHub or JIRA issue(s) (or N/A) -->
44
| Versions | <!-- product version number, e.g.: 1.7, 1.13, 2.0 -->
5+
| Edition | <!-- Content/Headless, Experience, Commerce -->
56

67
<!-- Replace this comment with Pull Request description -->
78

.github/workflows/build.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,30 @@ on:
99

1010
jobs:
1111
build:
12+
permissions:
13+
# Give the default GITHUB_TOKEN write permission to commit and push the
14+
# added or changed files to the repository.
15+
contents: write
1216

1317
runs-on: ubuntu-latest
1418
strategy:
1519
matrix:
1620
python-version: [3.8]
1721

1822
steps:
19-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v3
2024
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v2
25+
uses: actions/setup-python@v3
2226
with:
2327
python-version: ${{ matrix.python-version }}
28+
- name: Install php-cs-fixer
29+
run: composer require friendsofphp/php-cs-fixer --dev
30+
- name: Run PHP CS Fixer
31+
run: ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots
32+
- name: Commit changes
33+
uses: stefanzweifel/git-auto-commit-action@v4
34+
with:
35+
commit_message: PHP CS Fixes
2436
- name: Install dependencies
2537
run: |
2638
python -m pip install --upgrade pip

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
__pycache__/*
44
/site/
55
**/.idea/
6+
.php-cs-fixer.cache
7+
composer.lock

.readthedocs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ mkdocs:
44
configuration: mkdocs.yml
55
fail_on_warning: true
66

7+
build:
8+
os: ubuntu-20.04
9+
tools:
10+
python: "3.11"
11+
712
python:
8-
version: 3.8
913
install:
1014
- requirements: pip_require.txt
1115
- requirements: requirements.txt

README.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,55 @@
1-
# eZ Platform Developer Documentation
1+
# Ibexa DXP Developer Documentation
22

3-
This repository is the source for the [developer documentation for Ibexa DXP](https://doc.ibexa.co/en/latest),
4-
a DXP platform that is based on the Symfony Full Stack Framework in PHP.
3+
This repository is the source for the [developer documentation for Ibexa](https://doc.ibexa.co/en/latest),
4+
a digital experience platform that is based on the Symfony Full Stack Framework in PHP.
55

66
# Resources
77

88
1. Ibexa DXP Developer Hub: https://developers.ibexa.co
9-
1. Ibexa DXP Repository: https://github.com/ezsystems/ezplatform
9+
1. Ibexa DXP Repository: https://github.com/ibexa/oss
1010
1. Open JIRA board: https://issues.ibexa.co
1111
1. Ibexa Website: https://ibexa.co
1212
1. User documentation: https://doc.ibexa.co/projects/userguide
1313

1414
## How to contribute
15-
https://doc.ibexa.co/en/master/community_resources/contributing
1615

17-
Invite yourself to the community Slack and join `#documentation-contrib`
16+
To contribute to the documentation, you can open a PR in this repository.
1817

19-
https://ez-community-on-slack.herokuapp.com/
18+
If you'd like to see Ibexa DXP in your language, you can [contribute to the translations](https://doc.ibexa.co/en/latest/resources/contributing/contribute_translations/).
19+
20+
### Contribute to API reference
21+
22+
The REST API Reference is located in the `docs/api/rest_api/rest_api_reference/rest_api_reference.html`
23+
file, which is generated automatically by the RAML2HTML tool.
24+
It is based on `*.raml` files located in the `docs/api/rest_api/rest_api_reference/input` directory that you can edit in your editor/IDE.
25+
26+
After you modify relevant files in the input folder, you can generate an HTML file from repository root (this step can also be performed by one of the Tech Writers during PR review):
27+
28+
`php tools/raml2html/raml2html.php build --non-standard-http-methods=COPY,MOVE,PUBLISH,SWAP -t default -o docs/api/rest_api/rest_api_reference/output/ docs/api/rest_api/rest_api_reference/input/ez.raml`
29+
30+
In case of errors, look for mistakes in the RAML file, for example, double apostrophes.
31+
Move `rest_api_reference.html` from the output folder to `docs/api/rest_api/rest_api_reference/` root.
32+
33+
See `tools/raml2html/README.md` for more information.
34+
35+
## Build and preview documentation
36+
37+
To build and preview your changes locally, you need to install Python along with its package manager (`pip`).
38+
Other required tools will be installed by using the following command:
2039

21-
## Building & preview
22-
To build and preview your changes locally, you will need Python along with its package manager (`pip`).
23-
Other required tools will be installed by `pip` using the following command:
2440
```bash
2541
pip install -r requirements.txt
2642
```
2743

2844
Then you can run:
45+
2946
```bash
3047
mkdocs serve
3148
```
49+
3250
After a short while your documentation should be reachable at http://localhost:8000. If it isn't, check the output
3351
of the command.
3452

3553
## Where to View
54+
3655
https://doc.ibexa.co
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
custom_checkout:
2+
path: /custom_checkout
3+
defaults:
4+
_controller: App\Controller\CustomCheckoutController::showContentAction
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Command;
6+
7+
use Ibexa\Contracts\Cart\CartServiceInterface;
8+
use Ibexa\Contracts\Cart\Value\CartCreateStruct;
9+
use Ibexa\Contracts\Cart\Value\CartMetadataUpdateStruct;
10+
use Ibexa\Contracts\Cart\Value\CartQuery;
11+
use Ibexa\Contracts\Cart\Value\EntryAddStruct;
12+
use Ibexa\Contracts\Cart\Value\EntryUpdateStruct;
13+
use Ibexa\Contracts\Core\Repository\UserService;
14+
use Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface;
15+
use Ibexa\Contracts\ProductCatalog\ProductServiceInterface;
16+
use Ibexa\Core\Repository\Permission\PermissionResolver;
17+
use Symfony\Component\Console\Command\Command;
18+
use Symfony\Component\Console\Input\InputInterface;
19+
use Symfony\Component\Console\Output\OutputInterface;
20+
21+
final class CartCommand extends Command
22+
{
23+
private PermissionResolver $permissionResolver;
24+
25+
private UserService $userService;
26+
27+
private CartServiceInterface $cartService;
28+
29+
private CurrencyServiceInterface $currencyService;
30+
31+
private ProductServiceInterface $productService;
32+
33+
public function __construct(
34+
PermissionResolver $permissionResolver,
35+
UserService $userService,
36+
CartServiceInterface $cartService,
37+
CurrencyServiceInterface $currencyService,
38+
ProductServiceInterface $productService
39+
) {
40+
$this->cartService = $cartService;
41+
$this->permissionResolver = $permissionResolver;
42+
$this->userService = $userService;
43+
$this->currencyService = $currencyService;
44+
$this->productService = $productService;
45+
46+
parent::__construct('doc:cart');
47+
}
48+
49+
public function configure(): void
50+
{
51+
}
52+
53+
protected function execute(InputInterface $input, OutputInterface $output): int
54+
{
55+
$this->permissionResolver->setCurrentUserReference(
56+
$this->userService->loadUserByLogin('admin')
57+
);
58+
59+
// Query for carts
60+
$cartQuery = new CartQuery();
61+
$cartQuery->setOwnerId(14); // carts created by User ID: 14
62+
$cartQuery->setLimit(20); // fetch 20 carts
63+
64+
$cartsList = $this->cartService->findCarts($cartQuery);
65+
66+
$cartsList->getCarts(); // array of CartInterface objects
67+
$cartsList->getTotalCount(); // number of returned carts
68+
69+
foreach ($cartsList as $cart) {
70+
$output->writeln($cart->getIdentifier() . ': ' . $cart->getName());
71+
}
72+
73+
// Get a single cart
74+
$cart = $this->cartService->getCart('1844450e-61da-4814-8d82-9301a3df0054');
75+
76+
$output->writeln($cart->getName());
77+
78+
// Create a new cart
79+
$currency = $this->currencyService->getCurrencyByCode('EUR');
80+
81+
$cartCreateStruct = new CartCreateStruct(
82+
'Default cart',
83+
$currency // Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface
84+
);
85+
86+
$cart = $this->cartService->createCart($cartCreateStruct);
87+
88+
$output->writeln($cart->getName()); // prints 'Default cart' to the console
89+
90+
// Update a cart
91+
$newCurrency = $this->currencyService->getCurrencyByCode('PLN');
92+
93+
$cartUpdateMetadataStruct = new CartMetadataUpdateStruct();
94+
$cartUpdateMetadataStruct->setName('New name');
95+
$cartUpdateMetadataStruct->setCurrency($newCurrency);
96+
97+
$updatedCart = $this->cartService->updateCartMetadata($cart, $cartUpdateMetadataStruct);
98+
99+
$output->writeln($updatedCart->getName()); // prints 'New name' to the console
100+
101+
// Empty a cart
102+
$this->cartService->emptyCart($cart);
103+
104+
// Validate a cart
105+
$violationList = $this->cartService->validateCart($cart); // Symfony\Component\Validator\ConstraintViolationListInterface
106+
107+
// Add product to a cart
108+
$product = $this->productService->getProduct('desk1');
109+
110+
$entryAddStruct = new EntryAddStruct($product);
111+
$entryAddStruct->setQuantity(10);
112+
113+
$cart = $this->cartService->addEntry($cart, $entryAddStruct);
114+
115+
$entry = $cart->getEntries()->first();
116+
$output->writeln($entry->getProduct()->getName()); // prints product name to the console
117+
118+
// Remove an entry from a cart
119+
// find entry you would like to remove from cart
120+
$entry = $cart->getEntries()->first();
121+
122+
$cart = $this->cartService->removeEntry($cart, $entry); // updated Cart object
123+
124+
// Update entry in a cart
125+
$entryUpdateStruct = new EntryUpdateStruct(5);
126+
$entryUpdateStruct->setQuantity(10);
127+
128+
$cart = $this->cartService->updateEntry(
129+
$cart,
130+
$entry,
131+
$entryUpdateStruct
132+
); // updated Cart object
133+
134+
// Delete a cart permanently
135+
$this->cartService->deleteCart($cart);
136+
137+
return self::SUCCESS;
138+
}
139+
}

0 commit comments

Comments
 (0)