Skip to content

Commit

Permalink
feat: define some property and return types
Browse files Browse the repository at this point in the history
  • Loading branch information
tinect committed Sep 9, 2023
1 parent c4a5ce8 commit 9679476
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
15 changes: 3 additions & 12 deletions src/CrossSellingComparable/CrossSellingComparableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,11 @@ class CrossSellingComparableEntity extends Entity
{
use EntityIdTrait;

/**
* @var string
*/
protected $productCrossSellingId;
protected string $productCrossSellingId;

/**
* @var ProductCrossSellingEntity
*/
protected $productCrossSelling;
protected ProductCrossSellingEntity $productCrossSelling;

/**
* @var bool|null
*/
protected $isComparable;
protected ?bool $isComparable;

public function getProductCrossSellingId(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function getCreationTimestamp(): int

public function update(Connection $connection): void
{
$connection->executeUpdate('
$connection->executeStatement('
CREATE TABLE `frosh_cross_selling_comparable` (
`id` BINARY(16) NOT NULL PRIMARY KEY,
`product_cross_selling_id` BINARY(16) NOT NULL,
Expand Down
5 changes: 3 additions & 2 deletions src/Subscriber/FroshCrossSellingProductListingSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Shopware\Core\Content\Product\SalesChannel\Listing\ProductListingResult;
use Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\MultiFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\NotFilter;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
Expand All @@ -27,7 +28,7 @@ public function __construct(
) {
}

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
ProductCrossSellingStreamCriteriaEvent::class => [
Expand Down Expand Up @@ -68,7 +69,7 @@ public function handleCriteriaLoadedRequest(ProductCrossSellingCriteriaEvent $ev
->addAssociation('properties.group')
->addAssociation('properties.media')
->addAssociation('mainCategories.category')
->addFilter(new NotFilter(NotFilter::CONNECTION_AND, [new EqualsFilter('id', $crossSelling->getProductId())]))
->addFilter(new NotFilter(MultiFilter::CONNECTION_AND, [new EqualsFilter('id', $crossSelling->getProductId())]))
->setLimit(CompareProductPageLoader::MAX_COMPARE_PRODUCT_ITEMS);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/FroshProductGatewayCriteriaSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class FroshProductGatewayCriteriaSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
ProductGatewayCriteriaEvent::class => [
Expand Down

0 comments on commit 9679476

Please sign in to comment.