I'm trying to create a custom table in my module but I keep getting this error:
Warning: array_key_exists() expects parameter 2 to be array, string given in
I've been able to step through the code and it seems to break when this is executed:
$newTable = $setup->getConnection()->newTable($installer->getTable('orders'))->addColumn(
'id', Table::TYPE_INTEGER, null, [
'identity' => true,
'unsigned' => true,
'nullable' => false,
'primary' => true
], ' Id'
)->addColumn(
'orderid', Table::TYPE_TEXT,
255, [
'nullable' => false
], 'sku'
)->addColumn(
'last_updated_date', Table::TYPE_DATETIME, null, [
'nullable' => false
], 'last_updated_date'
)->addColumn(
'total_price', Table::TYPE_INTEGER, null, [
'nullable' => false
], 'price'
)->addColumn(
'order_state', Table::TYPE_TEXT, 255, [
'nullable' => false
], 'order_state'
)->addColumn(
'fields', Table::TYPE_TEXT, 2048, [
'nullable' => false
], 'fields'
)->addColumn(
'order', Table::TYPE_TEXT, 255, [
'nullable' => false
], 'o_id'
)->addColumn(
'comment', Table::TYPE_TEXT, 255, [
'nullable' => false
], 'comment'
)->addColumn(
'read', Table::TYPE_SMALLINT, 1, [
'nullable' => false,
'default' => 0
], 'read'
)->addColumn(
'in_stock', Table::TYPE_SMALLINT, null, [
'nullable' => false,
'default' => 0
], 'in_stock'
)->addColumn(
'product_title', Table::TYPE_TEXT, 255, [
'nullable', false,
], 'title'
)->addColumn(
'qty', Table::TYPE_NUMERIC, null, [
], 'qty'
);
Can anyone tell what I'm doing wrong here???
This is where the exception occurs
if (array_key_exists('default', $options)) {
$default = $options['default'];
}
vendor/magento/framework/DB/Ddl/Table.php on line 352