Skip to content

Commit 42ede63

Browse files
authored
IBX-11083: Add missing code, fix code (#3078)
* Add services.yaml and Mapper.php * Move SQL to files * Remove copyright for sharability * Rector * collaboration_search_reference: Fix highlights * collaboration/config/services.yaml: Fixes * collaboration/config/services.yaml: Format * Move template to storefront theme standard/cart/view.html.twig is always overridden by storefront/cart/view.html.twig from the bundle As the template depends on and extends the storefront theme, they're part of it. * Redesign share.html.twig for storefront * Simplify cart/view.html.twig * Redesign share_result.html.twig for storefront
1 parent d0e3c85 commit 42ede63

33 files changed

Lines changed: 176 additions & 271 deletions
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This file is the entry point to configure your own services.
2+
# Files in the packages/ subdirectory configure your dependencies.
3+
4+
# Put parameters here that don't need to change on each machine where the app is deployed
5+
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
6+
parameters:
7+
8+
services:
9+
# default configuration for services in *this* file
10+
_defaults:
11+
autowire: true # Automatically injects dependencies in your services.
12+
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
13+
14+
# makes classes in src/ available to be used as services
15+
# this creates a service per class whose id is the fully-qualified class name
16+
App\:
17+
resource: '../src/'
18+
19+
# add more service definitions when explicit configuration is needed
20+
# please note that last definitions always *replace* previous ones
21+
22+
App\Collaboration\Cart\Persistence\Gateway\DatabaseGateway:
23+
arguments:
24+
$connection: '@ibexa.persistence.connection'
25+
tags:
26+
- name: 'ibexa.collaboration.persistence.session.gateway'
27+
discriminator: !php/const App\Collaboration\Cart\Persistence\Gateway\DatabaseGateway::DISCRIMINATOR
28+
29+
App\Collaboration\Cart\Persistence\Mapper:
30+
tags:
31+
- name: 'ibexa.collaboration.persistence.session.mapper'
32+
discriminator: !php/const App\Collaboration\Cart\Persistence\Gateway\DatabaseGateway::DISCRIMINATOR
33+
34+
App\Collaboration\Cart\Mapper\CartSessionDomainMapper:
35+
tags:
36+
- name: 'ibexa.collaboration.service.session.domain.mapper'
37+
type: App\Collaboration\Cart\Persistence\Values\CartSession
38+
39+
App\Collaboration\Cart\Mapper\CartSessionPersistenceMapper:
40+
tags:
41+
- name: 'ibexa.collaboration.service.session.persistence.mapper'
42+
type: !php/const App\Collaboration\Cart\CartSessionType::IDENTIFIER
43+
44+
App\Collaboration\Cart\PermissionResolverDecorator:
45+
decorates: Ibexa\Contracts\ProductCatalog\PermissionResolverInterface
46+
47+
App\Collaboration\Cart\CartResolverDecorator:
48+
decorates: Ibexa\Contracts\Cart\CartResolverInterface
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CREATE TABLE ibexa_collaboration_cart (
2+
id INT NOT NULL PRIMARY KEY,
3+
cart_identifier VARCHAR(255) NOT NULL,
4+
CONSTRAINT ibexa_collaboration_cart_ibexa_collaboration_id_fk
5+
FOREIGN KEY (id) REFERENCES ibexa_collaboration (id)
6+
ON DELETE CASCADE
7+
) COLLATE = utf8mb4_general_ci;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CREATE TABLE ibexa_collaboration_cart (
2+
id INTEGER NOT NULL PRIMARY KEY,
3+
cart_identifier VARCHAR(255) NOT NULL,
4+
CONSTRAINT ibexa_collaboration_cart_ibexa_collaboration_id_fk
5+
FOREIGN KEY (id) REFERENCES ibexa_collaboration (id)
6+
ON DELETE CASCADE
7+
);

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
<?php
2-
3-
/**
4-
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5-
* @license For full copyright and license information view LICENSE file distributed with this source code.
6-
*/
7-
declare(strict_types=1);
1+
<?php declare(strict_types=1);
82

93
namespace App\Collaboration\Cart;
104

@@ -15,7 +9,7 @@
159
use Ibexa\Contracts\Core\Repository\Values\User\User;
1610
use Symfony\Component\HttpFoundation\RequestStack;
1711

18-
final class CartResolverDecorator implements CartResolverInterface
12+
final readonly class CartResolverDecorator implements CartResolverInterface
1913
{
2014
public function __construct(
2115
private CartResolverInterface $innerCartResolver,
@@ -45,7 +39,7 @@ private function getSharedCart(): ?CartInterface
4539
}
4640

4741
return $session->getCart();
48-
} catch (NotFoundException|\Ibexa\ProductCatalog\Exception\UnauthorizedException $e) {
42+
} catch (NotFoundException|\Ibexa\ProductCatalog\Exception\UnauthorizedException) {
4943
return null;
5044
}
5145
}

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
<?php
2-
3-
/**
4-
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5-
* @license For full copyright and license information view LICENSE file distributed with this source code.
6-
*/
7-
declare(strict_types=1);
1+
<?php declare(strict_types=1);
82

93
namespace App\Collaboration\Cart;
104

@@ -16,11 +10,9 @@
1610

1711
final class CartSession extends AbstractSession
1812
{
19-
private CartInterface $cart;
20-
2113
public function __construct(
2214
int $id,
23-
CartInterface $cart,
15+
private readonly CartInterface $cart,
2416
string $token,
2517
User $owner,
2618
ParticipantCollectionInterface $participants,
@@ -30,8 +22,6 @@ public function __construct(
3022
DateTimeInterface $updatedAt
3123
) {
3224
parent::__construct($id, $token, $owner, $participants, $isActive, $hasPublicLink, $createdAt, $updatedAt);
33-
34-
$this->cart = $cart;
3525
}
3626

3727
public function getCart(): CartInterface

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
<?php
2-
3-
/**
4-
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5-
* @license For full copyright and license information view LICENSE file distributed with this source code.
6-
*/
7-
declare(strict_types=1);
1+
<?php declare(strict_types=1);
82

93
namespace App\Collaboration\Cart;
104

@@ -13,13 +7,9 @@
137

148
final class CartSessionCreateStruct extends AbstractSessionCreateStruct
159
{
16-
private CartInterface $cart;
17-
18-
public function __construct(CartInterface $cart)
10+
public function __construct(private CartInterface $cart)
1911
{
2012
parent::__construct();
21-
22-
$this->cart = $cart;
2313
}
2414

2515
public function getCart(): CartInterface

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
<?php
2-
3-
/**
4-
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5-
* @license For full copyright and license information view LICENSE file distributed with this source code.
6-
*/
7-
declare(strict_types=1);
1+
<?php declare(strict_types=1);
82

93
namespace App\Collaboration\Cart;
104

115
use Ibexa\Contracts\Collaboration\Session\SessionScopeInterface;
126

137
final class CartSessionType implements SessionScopeInterface
148
{
15-
public const SCOPE_VIEW = 'view';
16-
public const SCOPE_EDIT = 'edit';
9+
public const string SCOPE_VIEW = 'view';
10+
public const string SCOPE_EDIT = 'edit';
1711

18-
public const IDENTIFIER = 'cart';
12+
public const string IDENTIFIER = 'cart';
1913

2014
private function __construct()
2115
{

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
<?php
2-
3-
/**
4-
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5-
* @license For full copyright and license information view LICENSE file distributed with this source code.
6-
*/
7-
declare(strict_types=1);
1+
<?php declare(strict_types=1);
82

93
namespace App\Collaboration\Cart;
104

code_samples/collaboration/src/Collaboration/Cart/Mapper/CartProxyMapper.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
<?php
2-
3-
/**
4-
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5-
* @license For full copyright and license information view LICENSE file distributed with this source code.
6-
*/
7-
declare(strict_types=1);
1+
<?php declare(strict_types=1);
82

93
namespace App\Collaboration\Cart\Mapper;
104

@@ -14,7 +8,7 @@
148
use Ibexa\Core\Repository\ProxyFactory\ProxyGeneratorInterface;
159
use ProxyManager\Proxy\LazyLoadingInterface;
1610

17-
final class CartProxyMapper implements CartProxyMapperInterface
11+
final readonly class CartProxyMapper implements CartProxyMapperInterface
1812
{
1913
public function __construct(
2014
private Repository $repository,

code_samples/collaboration/src/Collaboration/Cart/Mapper/CartProxyMapperInterface.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
<?php
2-
3-
/**
4-
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5-
* @license For full copyright and license information view LICENSE file distributed with this source code.
6-
*/
7-
declare(strict_types=1);
1+
<?php declare(strict_types=1);
82

93
namespace App\Collaboration\Cart\Mapper;
104

0 commit comments

Comments
 (0)