Skip to content

Commit aa65a22

Browse files
ENGCOM-5646: Allow null values for integer columns in declarative schema #23819
- Merge Pull Request #23819 from JeroenVanLeusden/magento2:JeroenVanLeusden-patch-4 - Merged commits: 1. 2454e0c 2. 843081b
2 parents 4e470c1 + 843081b commit aa65a22

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(
5050
}
5151

5252
/**
53-
* {@inheritdoc}
53+
* @inheritdoc
5454
*/
5555
public function create(array $data)
5656
{
@@ -63,7 +63,7 @@ public function create(array $data)
6363
}
6464

6565
if (isset($data['default'])) {
66-
$data['default'] = (int) $data['default'];
66+
$data['default'] = $data['default'] !== 'null' ? (int) $data['default'] : null;
6767
}
6868

6969
return $this->objectManager->create($this->className, $data);

lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/types/integers/integer.xsd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@
1717
Size is 4 bytes.
1818
</xs:documentation>
1919
</xs:annotation>
20-
<xs:attribute name="default" type="xs:integer" />
20+
<xs:attribute name="default">
21+
<xs:simpleType>
22+
<xs:restriction base="xs:string">
23+
<xs:pattern value="\d+|null" />
24+
</xs:restriction>
25+
</xs:simpleType>
26+
</xs:attribute>
2127
<xs:attribute name="padding">
2228
<xs:annotation>
2329
<xs:documentation>

0 commit comments

Comments
 (0)