Skip to content

Commit 06db5c7

Browse files
feat: add initial implementation of Nuonic Plugin Installer with database migration and service configuration
1 parent ff4935a commit 06db5c7

File tree

10 files changed

+454
-0
lines changed

10 files changed

+454
-0
lines changed

docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
services:
2+
shopware:
3+
image: dockware/dev:latest
4+
container_name: plugin-installer
5+
ports:
6+
- "80"
7+
- "3306"
8+
volumes:
9+
- ".:/var/www/html/custom/plugins/NuonicPluginInstaller"
10+
networks:
11+
- web
12+
environment:
13+
- XDEBUG_ENABLED=1
14+
- PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
15+
- SHOPWARE_ADMIN_BUILD_ONLY_EXTENSIONS=1
16+
- DISABLE_ADMIN_COMPILATION_TYPECHECK=1
17+
networks:
18+
web:
19+
name: web
20+
driver: bridge
21+
external: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace NuonicPluginInstaller\Core\Framework\Plugin\AvailableOpensourcePlugin\Aggregate\AvailableOpensourcePluginTranslation;
6+
7+
use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
8+
9+
class AvailableOpensourcePluginTranslationCollection extends EntityCollection
10+
{
11+
protected function getExpectedClass(): string
12+
{
13+
return AvailableOpensourcePluginTranslationEntity::class;
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace NuonicPluginInstaller\Core\Framework\Plugin\AvailableOpensourcePlugin\Aggregate\AvailableOpensourcePluginTranslation;
6+
7+
use NuonicPluginInstaller\Core\Framework\Plugin\AvailableOpensourcePlugin\AvailableOpensourcePluginDefinition;
8+
use Shopware\Core\Framework\DataAbstractionLayer\EntityTranslationDefinition;
9+
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Required;
10+
use Shopware\Core\Framework\DataAbstractionLayer\Field\StringField;
11+
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
12+
13+
class AvailableOpensourcePluginTranslationDefinition extends EntityTranslationDefinition
14+
{
15+
public const ENTITY_NAME = 'nuonic_available_opensource_plugin_translation';
16+
17+
public function getEntityName(): string
18+
{
19+
return self::ENTITY_NAME;
20+
}
21+
22+
public function getParentDefinitionClass(): string
23+
{
24+
return AvailableOpensourcePluginDefinition::class;
25+
}
26+
27+
public function getEntityClass(): string
28+
{
29+
return AvailableOpensourcePluginTranslationEntity::class;
30+
}
31+
32+
protected function defineFields(): FieldCollection
33+
{
34+
return new FieldCollection([
35+
(new StringField('name', 'name'))->addFlags(new Required()),
36+
(new StringField('description', 'description'))->addFlags(new Required()),
37+
]);
38+
}
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace NuonicPluginInstaller\Core\Framework\Plugin\AvailableOpensourcePlugin\Aggregate\AvailableOpensourcePluginTranslation;
6+
7+
use NuonicPluginInstaller\Core\Framework\Plugin\AvailableOpensourcePlugin\AvailableOpensourcePluginEntity;
8+
use Shopware\Core\Framework\DataAbstractionLayer\TranslationEntity;
9+
10+
class AvailableOpensourcePluginTranslationEntity extends TranslationEntity
11+
{
12+
protected string $availableOpensourcePluginId;
13+
14+
protected string $name;
15+
16+
protected string $description;
17+
18+
protected AvailableOpensourcePluginEntity $availableOpensourcePlugin;
19+
20+
public function getName(): string
21+
{
22+
return $this->name;
23+
}
24+
25+
public function setName(string $name): void
26+
{
27+
$this->name = $name;
28+
}
29+
30+
public function getDescription(): string
31+
{
32+
return $this->description;
33+
}
34+
35+
public function setDescription(string $description): void
36+
{
37+
$this->description = $description;
38+
}
39+
40+
public function getAvailableOpensourcePluginId(): string
41+
{
42+
return $this->availableOpensourcePluginId;
43+
}
44+
45+
public function setAvailableOpensourcePluginId(string $availableOpensourcePluginId): void
46+
{
47+
$this->availableOpensourcePluginId = $availableOpensourcePluginId;
48+
}
49+
50+
public function getAvailableOpensourcePlugin(): AvailableOpensourcePluginEntity
51+
{
52+
return $this->availableOpensourcePlugin;
53+
}
54+
55+
public function setAvailableOpensourcePlugin(AvailableOpensourcePluginEntity $availableOpensourcePlugin): void
56+
{
57+
$this->availableOpensourcePlugin = $availableOpensourcePlugin;
58+
}
59+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace NuonicPluginInstaller\Core\Framework\Plugin\AvailableOpensourcePlugin;
6+
7+
use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
8+
9+
class AvailableOpensourcePluginCollection extends EntityCollection
10+
{
11+
protected function getExpectedClass(): string
12+
{
13+
return AvailableOpensourcePluginEntity::class;
14+
}
15+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace NuonicPluginInstaller\Core\Framework\Plugin\AvailableOpensourcePlugin;
6+
7+
use NuonicPluginInstaller\Core\Framework\Plugin\AvailableOpensourcePlugin\Aggregate\AvailableOpensourcePluginTranslation\AvailableOpensourcePluginTranslationDefinition;
8+
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
9+
use Shopware\Core\Framework\DataAbstractionLayer\Field\BoolField;
10+
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\ApiAware;
11+
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey;
12+
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Required;
13+
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField;
14+
use Shopware\Core\Framework\DataAbstractionLayer\Field\JsonField;
15+
use Shopware\Core\Framework\DataAbstractionLayer\Field\StringField;
16+
use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslatedField;
17+
use Shopware\Core\Framework\DataAbstractionLayer\Field\TranslationsAssociationField;
18+
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
19+
20+
class AvailableOpensourcePluginDefinition extends EntityDefinition
21+
{
22+
public const ENTITY_NAME = 'nuonic_available_opensource_plugin';
23+
24+
public function getEntityName(): string
25+
{
26+
return self::ENTITY_NAME;
27+
}
28+
29+
public function getCollectionClass(): string
30+
{
31+
return AvailableOpensourcePluginCollection::class;
32+
}
33+
34+
public function getEntityClass(): string
35+
{
36+
return AvailableOpensourcePluginEntity::class;
37+
}
38+
39+
protected function defineFields(): FieldCollection
40+
{
41+
return new FieldCollection([
42+
(new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey()),
43+
(new TranslatedField('name', 'name'))->addFlags(new Required()),
44+
(new TranslatedField('description', 'description'))->addFlags(new Required()),
45+
(new StringField('manufacturer', 'manufacturer'))->addFlags(new Required()),
46+
(new StringField('manufacturerLink', 'manufacturerLink'))->addFlags(new Required()),
47+
(new StringField('icon', 'icon'))->addFlags(),
48+
(new JsonField('images', 'images'))->addFlags(),
49+
(new StringField('license', 'license'))->addFlags(new Required()),
50+
(new StringField('link', 'link'))->addFlags(new Required()),
51+
(new StringField('available_version', 'availableVersion'))->addFlags(new Required()),
52+
(new BoolField('is_installed', 'isInstalled'))->addFlags(new Required()),
53+
(new TranslationsAssociationField(
54+
AvailableOpensourcePluginTranslationDefinition::class,
55+
'available_opensource_plugin_id'
56+
))->addFlags(new ApiAware(), new Required())
57+
]);
58+
}
59+
}
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace NuonicPluginInstaller\Core\Framework\Plugin\AvailableOpensourcePlugin;
6+
7+
use Shopware\Core\Framework\DataAbstractionLayer\Entity;
8+
use Shopware\Core\Framework\DataAbstractionLayer\EntityIdTrait;
9+
10+
class AvailableOpensourcePluginEntity extends Entity
11+
{
12+
use EntityIdTrait;
13+
14+
/**
15+
* @var string
16+
*/
17+
protected string $name;
18+
19+
/**
20+
* @var string
21+
*/
22+
protected string $description;
23+
24+
/**
25+
* @var string
26+
*/
27+
protected string $manufacturer;
28+
29+
/**
30+
* @var string
31+
*/
32+
protected string $manufacturerLink;
33+
34+
/**
35+
* @var string|null
36+
*/
37+
protected ?string $icon;
38+
39+
/**
40+
* @var array|null
41+
*/
42+
protected ?array $images;
43+
44+
/**
45+
* @var string
46+
*/
47+
protected string $license;
48+
49+
/**
50+
* @var string
51+
*/
52+
protected string $link;
53+
54+
/**
55+
* @var string
56+
*/
57+
protected string $availableVersion;
58+
59+
/**
60+
* @var bool
61+
*/
62+
protected bool $isInstalled;
63+
64+
public function getName(): string
65+
{
66+
return $this->name;
67+
}
68+
69+
public function setName(string $name): void
70+
{
71+
$this->name = $name;
72+
}
73+
74+
public function getDescription(): string
75+
{
76+
return $this->description;
77+
}
78+
79+
public function setDescription(string $description): void
80+
{
81+
$this->description = $description;
82+
}
83+
84+
public function getManufacturer(): string
85+
{
86+
return $this->manufacturer;
87+
}
88+
89+
public function setManufacturer(string $manufacturer): void
90+
{
91+
$this->manufacturer = $manufacturer;
92+
}
93+
94+
public function getManufacturerLink(): string
95+
{
96+
return $this->manufacturerLink;
97+
}
98+
99+
public function setManufacturerLink(string $manufacturerLink): void
100+
{
101+
$this->manufacturerLink = $manufacturerLink;
102+
}
103+
104+
public function getIcon(): ?string
105+
{
106+
return $this->icon;
107+
}
108+
109+
public function setIcon(?string $icon): void
110+
{
111+
$this->icon = $icon;
112+
}
113+
114+
public function getImages(): ?array
115+
{
116+
return $this->images;
117+
}
118+
119+
public function setImages(?array $images): void
120+
{
121+
$this->images = $images;
122+
}
123+
124+
public function getLicense(): string
125+
{
126+
return $this->license;
127+
}
128+
129+
public function setLicense(string $license): void
130+
{
131+
$this->license = $license;
132+
}
133+
134+
public function getLink(): string
135+
{
136+
return $this->link;
137+
}
138+
139+
public function setLink(string $link): void
140+
{
141+
$this->link = $link;
142+
}
143+
144+
public function getAvailableVersion(): string
145+
{
146+
return $this->availableVersion;
147+
}
148+
149+
public function setAvailableVersion(string $availableVersion): void
150+
{
151+
$this->availableVersion = $availableVersion;
152+
}
153+
154+
public function isInstalled(): bool
155+
{
156+
return $this->isInstalled;
157+
}
158+
159+
public function setIsInstalled(bool $isInstalled): void
160+
{
161+
$this->isInstalled = $isInstalled;
162+
}
163+
164+
public function getApiAlias(): string
165+
{
166+
return 'available_opensource_plugin';
167+
}
168+
}

0 commit comments

Comments
 (0)