diff --git a/README.md b/README.md index 195eab9..195ef52 100644 --- a/README.md +++ b/README.md @@ -64,12 +64,17 @@ class AccountsTable extends Table * @param TableSchemaInterface $schema * @return TableSchemaInterface */ - protected function _initializeSchema(TableSchemaInterface $schema): TableSchemaInterface + public function initialize(array $config): void { - $schema->setColumnType('account_number', 'encrypted'); - $schema->setColumnType('email', 'encrypted'); + + parent::initialize($config); + + //... rest of initialization + + $this->getSchema()->setColumnType('account_number', 'encrypted'); + $this->getSchema()->setColumnType('email', 'encrypted'); + - return $schema; } } ``` diff --git a/src/Database/Type/EncryptType.php b/src/Database/Type/EncryptType.php index f75bf11..e9a22f3 100644 --- a/src/Database/Type/EncryptType.php +++ b/src/Database/Type/EncryptType.php @@ -22,7 +22,8 @@ class EncryptType extends BaseType * @param Driver $driver * @return mixed|string|null */ - public function toDatabase($value, DriverInterface $driver){ + public function toDatabase($value, \Cake\Database\Driver $driver): mixed + { if ($value === null) { return null; @@ -48,7 +49,8 @@ public function toDatabase($value, DriverInterface $driver){ * @param Driver $driver * @return mixed|string|null */ - public function toPHP($value, DriverInterface $driver){ + public function toPHP($value, \Cake\Database\Driver $driver): mixed + { if ($value === null) { return null; } @@ -59,7 +61,7 @@ public function toPHP($value, DriverInterface $driver){ * @param $value * @return mixed */ - public function marshal($value) + public function marshal($value): mixed { if ($value === null) { return null; @@ -77,7 +79,7 @@ public function marshal($value) * @param Driver $driver * @return int|mixed */ - public function toStatement($value, DriverInterface $driver) + public function toStatement($value, \Cake\Database\Driver $driver): int { if ($value === null) { return PDO::PARAM_NULL; @@ -85,5 +87,4 @@ public function toStatement($value, DriverInterface $driver) return PDO::PARAM_STR; } - }