- πΊπΈUnited States smustgrave
Change look good. #15 did the manual testing so just reviewing the code
Marking as RBTC but I wonder if
public function providerTestPreSave() {
andpublic function testPreSave($value, $scale, $expected) {
need to be typehinted even though they're test functions
The last submitted patch, 12: 3074419-12.patch, failed testing. View results β
The last submitted patch, 12: 3074419-12.patch, failed testing. View results β
- Status changed to Needs work
almost 2 years ago 9:40am 6 February 2023 - π¬π§United Kingdom alexpott πͺπΊπ
One thing that is interesting about this issue is that the schema and property definitions kinda clash.
/** * {@inheritdoc} */ public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) { $properties['value'] = DataDefinition::create('string') ->setLabel(new TranslatableMarkup('Decimal value')) ->setRequired(TRUE); return $properties; } /** * {@inheritdoc} */ public static function schema(FieldStorageDefinitionInterface $field_definition) { return [ 'columns' => [ 'value' => [ 'type' => 'numeric', 'precision' => $field_definition->getSetting('precision'), 'scale' => $field_definition->getSetting('scale'), ], ], ]; }
It really feels like we should have a decimal data type.
Also this change might result in problems for existing code that assume $this->value is set to float during saving so would require a change record.
- π§πͺBelgium leanderjcc Ghent
Regarding #22:
Since 10.2 (see https://www.drupal.org/node/3376447 β ) the decimal data definition is available and used on a DecimalItem.
Is this issue still relevant?