From edc4ca0345ca4e3830e7ba74d269ae2dabe31284 Mon Sep 17 00:00:00 2001 From: MarwanSalim <45453458+MarwanSalim@users.noreply.github.com> Date: Wed, 16 Dec 2020 11:55:02 +0800 Subject: [PATCH 1/2] Update Token.php `foreign_data` data type should be *array* because of this ```php /** * @param \Cake\Database\Schema\TableSchema $schema Schema * @return \Cake\Database\Schema\TableSchema */ protected function _initializeSchema(TableSchema $schema) { $schema->setColumnType('foreign_data', 'json'); return $schema; } ``` https://github.com/UseMuffin/Tokenize/blob/master/src/Model/Table/TokensTable.php#L118 Furthere readings: >The code above maps the preferences column to the json custom type. This means that when retrieving data for that column, it will be unserialized from a JSON string in the database and put into an entity as an array. Reference: https://book.cakephp.org/3/en/orm/saving-data.html#saving-complex-types Thank you --- src/Model/Entity/Token.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Entity/Token.php b/src/Model/Entity/Token.php index 6eb8fba..038ca35 100644 --- a/src/Model/Entity/Token.php +++ b/src/Model/Entity/Token.php @@ -13,7 +13,7 @@ * @property string $foreign_alias * @property string $foreign_table * @property string $foreign_key - * @property string $foreign_data + * @property array $foreign_data * @property bool $status */ class Token extends Entity From 8daded4bfdb60dd83c26a6aa373ba0ed4a1758d0 Mon Sep 17 00:00:00 2001 From: MarwanSalim <45453458+MarwanSalim@users.noreply.github.com> Date: Wed, 16 Dec 2020 14:20:05 +0800 Subject: [PATCH 2/2] Resolved circle-ci --- src/Model/Behavior/TokenizeBehavior.php | 2 +- src/Model/Entity/Token.php | 2 +- src/Model/Table/TokensTable.php | 2 +- tests/Fixture/TokensFixture.php | 2 +- tests/Fixture/UsersFixture.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Model/Behavior/TokenizeBehavior.php b/src/Model/Behavior/TokenizeBehavior.php index 83d21e6..39ab628 100644 --- a/src/Model/Behavior/TokenizeBehavior.php +++ b/src/Model/Behavior/TokenizeBehavior.php @@ -19,7 +19,7 @@ class TokenizeBehavior extends Behavior 'associationAlias' => 'Tokens', 'implementedEvents' => [ 'Model.beforeSave' => 'beforeSave', - ] + ], ]; /** diff --git a/src/Model/Entity/Token.php b/src/Model/Entity/Token.php index 038ca35..b27963f 100644 --- a/src/Model/Entity/Token.php +++ b/src/Model/Entity/Token.php @@ -34,7 +34,7 @@ public function __construct(array $properties = [], array $options = []) $properties += [ 'token' => self::random(), 'status' => false, - 'expired' => date('Y-m-d H:i:s', strtotime($lifetime)) + 'expired' => date('Y-m-d H:i:s', strtotime($lifetime)), ]; parent::__construct($properties, $options); } diff --git a/src/Model/Table/TokensTable.php b/src/Model/Table/TokensTable.php index fc98b8e..facbe81 100644 --- a/src/Model/Table/TokensTable.php +++ b/src/Model/Table/TokensTable.php @@ -44,7 +44,7 @@ public function findToken(Query $query, array $options) $options += [ 'token' => null, 'expired >' => new DateTime(), - 'status' => false + 'status' => false, ]; return $query->where($options); diff --git a/tests/Fixture/TokensFixture.php b/tests/Fixture/TokensFixture.php index 204d416..643e209 100644 --- a/tests/Fixture/TokensFixture.php +++ b/tests/Fixture/TokensFixture.php @@ -22,7 +22,7 @@ class TokensFixture extends TestFixture 'modified' => ['type' => 'datetime'], '_constraints' => [ 'primary' => ['type' => 'primary', 'columns' => ['id']], - ] + ], ]; public $records = [ diff --git a/tests/Fixture/UsersFixture.php b/tests/Fixture/UsersFixture.php index 978db9f..0cc13cf 100644 --- a/tests/Fixture/UsersFixture.php +++ b/tests/Fixture/UsersFixture.php @@ -15,7 +15,7 @@ class UsersFixture extends TestFixture 'password' => ['type' => 'string'], '_constraints' => [ 'primary' => ['type' => 'primary', 'columns' => ['id']], - ] + ], ]; public $records = [