Skip to content

Commit

Permalink
Merge pull request #1862 from dpfaffenbauer/issues/1860
Browse files Browse the repository at this point in the history
[IndexBundle] decimal should be 10,2
  • Loading branch information
dpfaffenbauer authored Feb 12, 2022
2 parents 33fb68b + 930b844 commit 32f07b7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/CoreShop/Bundle/IndexBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,7 @@ services:
arguments:
- '@coreshop.repository.index'
- '@coreshop.registry.index.worker'

CoreShop\Component\Index\Extension\DecimalIndexColumnTypeConfigExtension:
tags:
- { name: coreshop.index.extension }
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* CoreShop.
*
* This source file is subject to the GNU General Public License version 3 (GPLv3)
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org)
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3)
*/

declare(strict_types=1);

namespace CoreShop\Component\Index\Extension;

use CoreShop\Component\Index\Model\IndexColumnInterface;
use CoreShop\Component\Index\Model\IndexInterface;

class DecimalIndexColumnTypeConfigExtension implements IndexColumnTypeConfigExtension
{
public function getColumnConfig(IndexColumnInterface $column): array
{
if ($column->getColumnType() === IndexColumnInterface::FIELD_TYPE_DOUBLE) {
return ['scale' => 2];
}

return [];
}

public function supports(IndexInterface $index): bool
{
return $index->getWorker() === 'mysql';
}
}

0 comments on commit 32f07b7

Please sign in to comment.