-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1862 from dpfaffenbauer/issues/1860
[IndexBundle] decimal should be 10,2
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/CoreShop/Component/Index/Extension/DecimalIndexColumnTypeConfigExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} | ||
} |