Skip to content

Commit

Permalink
Fix schema default setting
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 19, 2024
1 parent ecc12e6 commit 67fdd8a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,13 @@ If you just want to map certain fields, you need to use an alias for those.
'CakeDecimal\Database\Type\DecimalObjectType',
);
```
Then inside your Table classes set them explicitly inside `getSchema()`:
Then inside your Table classes set them explicitly inside `initialize()`:
```php
/**
* @return \Cake\Database\Schema\TableSchemaInterface
*/
public function getSchema(): TableSchemaInterface {
$schema = parent::getSchema();
$schema->setColumnType('amount', 'decimal_object');
...
public function initialize(array $config): void {
parent::initialize($config);

return $schema;
...
$this->getSchema()->setColumnType('amount', 'decimal_object');
}
```

Expand Down

0 comments on commit 67fdd8a

Please sign in to comment.