Skip to content

Commit bd800f0

Browse files
fixes after dev-rev
1 parent 70284f9 commit bd800f0

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

code_samples/collaboration/src/Collaboration/Cart/CartSession.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,36 @@
66
*/
77
declare(strict_types=1);
88

9-
namespace App\Collaboration\Cart\Persistence\Values;
9+
namespace App\Collaboration\Cart;
1010

11-
use DateTimeImmutable;
12-
use Ibexa\Collaboration\Persistence\Values\AbstractSession;
11+
use DateTimeInterface;
12+
use Ibexa\Contracts\Cart\Value\CartInterface;
13+
use Ibexa\Contracts\Collaboration\Participant\ParticipantCollectionInterface;
14+
use Ibexa\Contracts\Collaboration\Session\AbstractSession;
15+
use Ibexa\Contracts\Core\Repository\Values\User\User;
1316

1417
final class CartSession extends AbstractSession
1518
{
16-
private string $cartIdentifier;
19+
private CartInterface $cart;
1720

1821
public function __construct(
1922
int $id,
20-
string $cartIdentifier,
23+
CartInterface $cart,
2124
string $token,
22-
int $userId,
25+
User $owner,
26+
ParticipantCollectionInterface $participants,
2327
bool $isActive,
2428
bool $hasPublicLink,
25-
DateTimeImmutable $createdAt,
26-
DateTimeImmutable $updatedAt
29+
DateTimeInterface $createdAt,
30+
DateTimeInterface $updatedAt
2731
) {
28-
parent::__construct($id, $token, $userId, $isActive, $hasPublicLink, $createdAt, $updatedAt);
32+
parent::__construct($id, $token, $owner, $participants, $isActive, $hasPublicLink, $createdAt, $updatedAt);
2933

30-
$this->cartIdentifier = $cartIdentifier;
34+
$this->cart = $cart;
3135
}
3236

33-
public function getCartIdentifier(): string
37+
public function getCart(): CartInterface
3438
{
35-
return $this->cartIdentifier;
39+
return $this->cart;
3640
}
3741
}

docs/content_management/collaborative_editing/extend_collaborative_editing.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ In this example, it represents the shopping Cart (identified by the Cart identif
4747
);
4848
```
4949

50-
## Set up the persistance layer
50+
## Set up the persistence layer
5151

5252
To extend Collaborative editing feature to support shared Cart collaboration, you need to prepare the persistence layer.
5353
This layer handles how the data about collaboration session and the Cart is stored, retrieved, and managed in the database.
@@ -62,7 +62,7 @@ It handles all the create, read, update, and delete operations for collaboration
6262
It also uses a Discriminator to specify the session type, so it can interact with the correct tables and data structures.
6363
This way, the system knows which Gateway to use to get or save the right data for each session type.
6464

65-
When creating the Database Gateways and mappers, you can use the build-in service tag: `ibexa.collaboration.persistence.session.gateway`:
65+
When creating the Database Gateways and mappers, you can use the built-in service tag: `ibexa.collaboration.persistence.session.gateway`:
6666

6767
```yaml
6868
tags:
@@ -143,7 +143,7 @@ In the `Collaboration/Cart` directory create the following Session Structs:
143143

144144
Mappers are used to return session data into the format the database needs and to send it to the repository.
145145

146-
In the `src\Collaboration\Cart\Mapper` folder create four mappers:
146+
In the `src/Collaboration/Cart/Mapper` folder create four mappers:
147147

148148
- `CartProxyMapper` - creates a simplified version of the Cart with only the necessary data to reduce memory usage in collaboration sessions.
149149

@@ -188,7 +188,7 @@ In the `src/Collaboration/Cart` directory, create the following files:
188188
[[= include_file('code_samples/collaboration/src/Collaboration/Cart/PermissionResolverDecorator.php') =]]
189189
```
190190

191-
- `CartResolverDecorator` extends the permission resolver to allow access to shared Carts in collaboration sessions, it checks if a Cart belongs to a collaboration session.
191+
- `CartResolverDecorator` resolves the shared Carts in collaboration sessions, it checks if a Cart belongs to a collaboration session.
192192

193193
``` php
194194
[[= include_file('code_samples/collaboration/src/Collaboration/Cart/CartResolverDecorator.php') =]]
@@ -222,7 +222,7 @@ In the next step, `addParticipant`, the user whose email address was provided is
222222
It enables joining a Cart session.
223223
The session token created earlier is passed in the URL, and in the `Join` action the system attempts to retrieve the session associated with that token.
224224
If the token is invalid, an exception is thrown indicating that the session cannot be accessed.
225-
If the session exists, the session parameter (`current_collaboration_session`) is retrieved and store the token.
225+
If the session exists, the session parameter (`collaboration_session`) is retrieved and store the token.
226226
Finally, `redirectToRoute` redirects the user to the Cart view and passes the identifier of the shared Cart.
227227

228228
``` php
@@ -231,7 +231,7 @@ Finally, `redirectToRoute` redirects the user to the Cart view and passes the id
231231

232232
!!! caution "Session parameter"
233233

234-
Avoid using a generic session parameter name such as `current_collaboration_session` (it's used here only for example purposes).
234+
Avoid using a generic session parameter name such as `collaboration_session` (it's used here only for example purposes).
235235
The user can participate in multiple sessions simultaneously (of one or many types), so using this parameter would cause it to be constantly overwritten.
236236
Therefore, active sessions should not be resolved based on such parameter.
237237

0 commit comments

Comments
 (0)