Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
klimov-paul committed Dec 22, 2023
1 parent d30311c commit 1e58be5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ $model->setAttributes([
]);

if ($model->validate()) {
var_dump($model->id); // outputs: int(123456)
var_dump($model->price); // outputs: float(10.5)
var_dump($model->amount); // outputs: int(14)
var_dump($model->is_active); // outputs: bool(true)
Expand All @@ -124,7 +125,7 @@ var_dump($model->is_active); // outputs: bool(true)
```


### JSON typecasting <span id="json-typecasting"></span>
### JSON Typecasting <span id="json-typecasting"></span>

This behavior allows automatic conversion of array or traversable objects into JSON string on model saving.
For example:
Expand Down Expand Up @@ -208,7 +209,7 @@ $model->save();
```


### DateTime typecasting <span id="datetime-typecasting"></span>
### DateTime Typecasting <span id="datetime-typecasting"></span>

This behavior allows automatic conversion of `\DateTime` instances into ISO datetime string on model saving.
For example:
Expand Down Expand Up @@ -283,7 +284,7 @@ In order to convert dates to `\Carbon\Carbon` you should use following types:
- `\yii1tech\model\typecast\TypecastBehavior::TYPE_TIMESTAMP_CARBON`


### Custom typecasting <span id="custom-typecasting"></span>
### Custom Typecasting <span id="custom-typecasting"></span>

You may specify any custom typecasting for the attribute using a callable as a type specification at `\yii1tech\model\typecast\TypecastBehavior::$attributeTypes`.
For example:
Expand Down

0 comments on commit 1e58be5

Please sign in to comment.