Skip to content

Commit 299cdc4

Browse files
committed
Fix schema overwrite.
1 parent a9cdb75 commit 299cdc4

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/Model/Behavior/JsonableBehavior.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ public function initialize(array $config): void {
6666
throw new RuntimeException('Fields and Map need to be of the same length if map is specified.');
6767
}
6868
foreach ($this->_config['fields'] as $field) {
69-
$this->_table->getSchema()->setColumnType($field, 'array');
69+
if ($this->_table->getSchema()->getColumnType($field) !== 'json') {
70+
$this->_table->getSchema()->setColumnType($field, 'json');
71+
}
7072
}
7173
if ($this->_config['encodeParams']['options'] === null) {
7274
$options = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_ERROR_INF_OR_NAN | JSON_PARTIAL_OUTPUT_ON_ERROR;

src/Model/Table/QueuedJobsTable.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,8 @@ public function initialize(array $config): void {
125125
'WorkerProcesses.workerkey = QueuedJobs.workerkey',
126126
],
127127
]);
128-
}
129-
130-
/**
131-
* @return \Cake\Database\Schema\TableSchemaInterface
132-
*/
133-
public function getSchema(): TableSchemaInterface {
134-
$schema = parent::getSchema();
135-
$schema->setColumnType('data', 'json');
136128

137-
return $schema;
129+
$this->getSchema()->setColumnType('data', 'json');
138130
}
139131

140132
/**

0 commit comments

Comments
 (0)