Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreGauthier committed Jun 18, 2024
2 parents 0c17288 + c6f1d77 commit 1f6537e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
use Gally\SyliusPlugin\Model\GallyChannelTrait;
use Sylius\Component\Core\Model\Channel as BaseChannel;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_channel")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_channel')]
class Channel extends BaseChannel implements GallyChannelInterface
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"php": "^8.0",
"sylius/sylius": "^1.12",
"gally/gally-php-rest-sdk": "1.3.0"
"gally/gally-php-rest-sdk": "1.3.1"
},
"require-dev": {
"behat/behat": "^3.6.1",
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
parameters:
level: 5
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
paths:
- src
Expand Down
9 changes: 8 additions & 1 deletion src/Indexer/ProductIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Core\Model\TaxonInterface;
use Sylius\Component\Core\Repository\ProductRepositoryInterface;
use Sylius\Component\Locale\Model\LocaleInterface;
use Sylius\Component\Product\Model\ProductOptionValueInterface;
Expand Down Expand Up @@ -58,9 +59,14 @@ public function getDocumentsToIndex(
if (!empty($documentIdsToReindex)) {
$products = $this->productRepository->findBy(['id' => $documentIdsToReindex]);
} else {
$taxon = $channel->getMenuTaxon();
if (null === $taxon) {
throw new \LogicException('No menu taxon define for channel ' . $channel->getCode());
}
/** @var TaxonInterface $taxon */
$queryBuilder = $this->productRepository->createShopListQueryBuilder(
$channel,
$channel->getMenuTaxon(),
$taxon,
$locale->getCode(),
[],
true
Expand Down Expand Up @@ -88,6 +94,7 @@ private function formatProduct(ProductInterface $product, ChannelInterface $chan
'id' => "{$product->getId()}",
'sku' => [$product->getCode()],
'name' => [$product->getTranslation($locale->getCode())->getName()],
'description' => [$product->getTranslation($locale->getCode())->getDescription()],
'image' => [$this->formatMedia($product) ?: null],
'price' => $this->formatPrice($variant, $channel),
'stock' => [
Expand Down
14 changes: 5 additions & 9 deletions src/Model/GallyChannelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@

trait GallyChannelTrait
{
/**
* @ORM\Column(name="gally_active", type="boolean")
*/
#[ORM\Column(name: 'gally_active', type: 'boolean')]
protected $gallyActive = false;
/**
* @ORM\Column(name="gally_product_index_batch_size", type="integer")
*/

#[ORM\Column(name: 'gally_product_index_batch_size', type: 'integer')]
protected $gallyProductIndexBatchSize = 50;
/**
* @ORM\Column(name="gally_category_index_batch_size", type="integer")
*/

#[ORM\Column(name: 'gally_category_index_batch_size', type: 'integer')]
protected $gallyCategoryIndexBatchSize = 50;

public function getGallyActive(): bool
Expand Down

0 comments on commit 1f6537e

Please sign in to comment.