Skip to content

Commit d62c539

Browse files
committed
[UC-3] Use trait in channel & override mapping
1 parent da7fbca commit d62c539

5 files changed

Lines changed: 58 additions & 0 deletions

File tree

tests/Application/config/packages/_sylius.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ sylius_shop:
1616

1717
sylius_api:
1818
enabled: true
19+
20+
sylius_channel:
21+
resources:
22+
channel:
23+
classes:
24+
model: Tests\BitBag\SyliusUserComPlugin\Entity\Channel

tests/Application/config/packages/doctrine.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,14 @@ doctrine:
1212
charset: UTF8
1313

1414
url: '%env(resolve:DATABASE_URL)%'
15+
orm:
16+
auto_generate_proxy_classes: '%kernel.debug%'
17+
naming_strategy: doctrine.orm.naming_strategy.underscore
18+
auto_mapping: false
19+
mappings:
20+
App:
21+
is_bundle: false
22+
type: xml
23+
dir: '%kernel.project_dir%/src/Resources/doctrine'
24+
prefix: 'Tests\BitBag\SyliusUserComPlugin\Entity'
25+
alias: App
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\BitBag\SyliusUserComPlugin\Entity;
6+
7+
use BitBag\SyliusUserComPlugin\Entity\UserComApiAwareTrait;
8+
use Sylius\Component\Core\Model\Channel as BaseChannel;
9+
10+
class Channel extends BaseChannel implements ChannelInterface
11+
{
12+
use UserComApiAwareTrait;
13+
14+
public function getId(): ?int
15+
{
16+
return $this->id;
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\BitBag\SyliusUserComPlugin\Entity;
6+
7+
use Sylius\Component\Core\Model\ChannelInterface as BaseChannelInterface;
8+
9+
interface ChannelInterface extends BaseChannelInterface
10+
{
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
6+
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
7+
8+
<mapped-superclass name="Tests\BitBag\SyliusUserComPlugin\Entity\Channel" table="sylius_channel">
9+
<field name="userComUrl" column="user_com_url" type="string" nullable="true" />
10+
<field name="userComApiKey" column="user_com_api_key" type="string" nullable="true"/>
11+
</mapped-superclass>
12+
</doctrine-mapping>

0 commit comments

Comments
 (0)