Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Variants] introduce Variant Bundle #1990

Merged
merged 23 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c15c5f0
[Variants] introduce Variant Bundle
dpfaffenbauer May 4, 2022
0118c36
[Variants] fix installing product
dpfaffenbauer May 4, 2022
db6b16f
Update src/CoreShop/Component/Variant/composer.json
dpfaffenbauer May 4, 2022
bd11bdf
[Variants] remove serialize in twig
dpfaffenbauer May 4, 2022
feeebff
Merge branch 'features/variant' of github.com:dpfaffenbauer/CoreShop …
dpfaffenbauer May 4, 2022
680e044
[Variants] fix stan issues
dpfaffenbauer May 4, 2022
f76e24e
[Variants] fix stan issues
dpfaffenbauer May 4, 2022
a905b17
[Variants] fix tests
dpfaffenbauer May 4, 2022
cca02dc
[Variants] fix psalm tests
dpfaffenbauer May 4, 2022
058ad16
[VariantBundle] frontend for variants
breakone May 4, 2022
ab96491
Merge remote-tracking branch 'dpfaffenbauer/features/variant' into fe…
breakone May 4, 2022
e5fd493
[Variants] add ui tests
dpfaffenbauer May 4, 2022
e72b7e6
[Variants] tests
dpfaffenbauer May 4, 2022
b6f1617
[Variants] add sorting to tests
dpfaffenbauer May 4, 2022
c9e1a16
[Variants] add tests for not available variants
dpfaffenbauer May 4, 2022
f698aa0
[Variants] add screenshot command
dpfaffenbauer May 4, 2022
dc5d7fb
[Variants] add full log
dpfaffenbauer May 4, 2022
99dc862
[Variants] add full log
dpfaffenbauer May 4, 2022
90ff923
[Variants] upload pimcore logs on failure
dpfaffenbauer May 4, 2022
c83df6a
[Variants] upload pimcore logs on failure
dpfaffenbauer May 4, 2022
5adbad7
[Tests] reduce log levels and fix behat deprecated notice
dpfaffenbauer May 5, 2022
5c47b1d
[Variants] disable test for now, as I have no idea why it doesn't run
dpfaffenbauer May 5, 2022
0df56fa
[Variants] fix variant-bundle composer.json
dpfaffenbauer May 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/CoreShop/Behat/Context/Transform/VariantContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getAttributeGroup($name): AttributeGroupInterface
public function getAttributeColor($name): AttributeColorInterface
{
/**
* @var AttributeColorInterface[] $attributeColor
* @var AttributeColorInterface[] $attributes
*/
$attributes = $this->attributeColorRepository->findBy(['name' => $name]);

Expand All @@ -80,7 +80,7 @@ public function getAttributeColor($name): AttributeColorInterface
public function getAttributeValue($name): AttributeValueInterface
{
/**
* @var AttributeColorInterface[] $attributeColor
* @var AttributeValueInterface[] $attributes
*/
$attributes = $this->attributeValueRepository->findBy(['name' => $name]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@
"bodyStyle": "",
"datatype": "layout",
"permissions": null,
"children": [
"childs": [
{
"fieldtype": "coreShopRelation",
"stack": "coreshop.purchasable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function preUpdate(DataObjectEvent $dataObjectEvent): void
$object = $dataObjectEvent->getObject();

/**
* @var AttributeInterface $object
* @var AttributeInterface|null $object
*/
if (!$object instanceof AttributeInterface) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public static function getSubscribedEvents(): array
public function preUpdate(DataObjectEvent $dataObjectEvent): void
{
/**
* @var ProductVariantAwareInterface $object
* @psalm-var ProductVariantAwareInterface $object
* @var ProductVariantAwareInterface|null $object
* @psalm-var ProductVariantAwareInterface|null $object
*/
$object = $dataObjectEvent->getObject();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function validate($value, Constraint $constraint): void
Assert::isInstanceOf($constraint, ValidAttributesType::class);

/**
* @var null|Concrete&AttributeGroupInterface $parent
* @var null|AttributeGroupInterface $parent
*/
$parent = $value->getAttributeGroup();

Expand Down
2 changes: 1 addition & 1 deletion src/CoreShop/Component/Variant/AttributeCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getAttributes(array $products, bool $showInList = false): array
}
}

usort($resolvedGroups, fn($a, $b) => $a->getGroup()->getSorting() <=> $b->getGroup()->getSorting());
usort($resolvedGroups, static fn(ResolvedAttributeGroup $a, ResolvedAttributeGroup $b) => $a->getGroup()->getSorting() <=> $b->getGroup()->getSorting());

return $resolvedGroups;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

interface AttributeGroupInterface extends PimcoreModelInterface
{
public function getName(string $language): ?string;
public function getName(string $language = null): ?string;

public function setName(string $name, $language = null): ?string;

public function getSorting(): ?float;

Expand Down
2 changes: 2 additions & 0 deletions src/CoreShop/Component/Variant/Model/AttributeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ interface AttributeInterface extends PimcoreModelInterface
{
public function getName(string $language = null): ?string;

public function setName(string $name, $language = null): ?string;

public function getAttributeGroup(): ?AttributeGroupInterface;

public function setAttributeGroup(?AttributeGroupInterface $attributeGroup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface ProductVariantAwareInterface extends PimcoreModelInterface
{
public function getName(string $language = null): ?string;

public function setName(string $name, string $language = null);
public function setName(string $name, $language = null);

/**
* @return AttributeInterface[]|null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function setGroup(AttributeGroupInterface $group): void
public function getAttributes(): array
{
$attributes = $this->attributes->toArray();
usort($attributes, fn($a, $b) => $a->getAttribute()->getSorting() <=> $b->getAttribute()->getSorting());
usort($attributes, static fn(ResolvedAttribute $a, ResolvedAttribute $b) => $a->getAttribute()->getSorting() <=> $b->getAttribute()->getSorting());

return $attributes;
}
Expand Down
2 changes: 1 addition & 1 deletion src/CoreShop/Component/Variant/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
],
"require": {
"coreshop/resource": "^3.0
"coreshop/resource": "^3.0"
},
"require-dev": {
"phpstan/phpstan": "^1.5.4",
Expand Down