Skip to content

corrections for cake5.x #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
```
Expand Down
11 changes: 6 additions & 5 deletions src/Database/Type/EncryptType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -77,13 +79,12 @@ 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;
}

return PDO::PARAM_STR;
}

}