Skip to content
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

Update Token.php #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

MarwanSalim
Copy link

@MarwanSalim MarwanSalim commented Dec 16, 2020

I want to suggest the followings:

The foreign_data datatype should be an array because of this:

    /**
     * @param \Cake\Database\Schema\TableSchema $schema Schema
     * @return \Cake\Database\Schema\TableSchema
     */
    protected function _initializeSchema(TableSchema $schema)
    {
        $schema->setColumnType('foreign_data', 'json');

        return $schema;
    }

Code reference: https://github.com/UseMuffin/Tokenize/blob/master/src/Model/Table/TokensTable.php#L118

Further 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

`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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant