If I use 2.0.2 version and run composer install
I got error with softcreatr/jsonpath
, because don't support 8.1 in ^0.7.
Easier fix would be just add softcreatr/jsonpath: ^0.5 | ^0.7 | ^0.8
into composer.json.
I'm in middle of migration, so I need to use php 7.4 and 8.1 at same time.
It works correct, thanks ^^
Example code:
$model = new Model($this->connection);// $connection is instance of Yiisoft\Db\Connection\ConnectionInterface
$model->type = 5;
$model->status = 4;
$model->created_at = date('Y-m-d h:i:s');
$model->updated_at = date('Y-m-d h:i:s');
$model->save();
$identifier = $model->primaryKey;
$cmd = $this->connection->createCommand('SELECT * FROM ' . $model->tableName() . ' WHERE id = :id', [
'id' => $identifier
]);
$cmd->execute();
var_dump($cmd->queryAll());
Example schema of model:
CREATE TABLE `model` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` tinyint(1) unsigned NOT NULL,
`status` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '0: disable, 1: pending, 2: active, 3: error',
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
array(1) { [0]=> array(9) { ["id"]=> string(1) "4" ["type"]=> string(1) "5" ["status"]=> string(1) "4" ["created_at"]=> string(19) "2023-01-29 03:24:48" ["updated_at"]=> string(19) "2023-01-29 03:24:48" } }
array(1) { [0]=> array(9) { ["id"]=> string(1) "4" ["type"]=> string(1) "1" ["status"]=> string(1) "1" ["created_at"]=> string(19) "2023-01-29 03:24:48" ["updated_at"]=> string(19) "2023-01-29 03:24:48" } }
| Q | A | ---------------- | --- | Version | 1.0.? | PHP version | 8.1.14 | MariaDB version | 10.3.37 | Operating system | Linux Mint 20.3
My mariadb database got column tinyint(1) where I'm holding numbers from 0-7. Because of that change when I'm trying to use ActiveRecord to save model with other values than 0 always got 1 in database. Is there any option to control value types as I want?