Skip to content

Breaking change in 4.2.0: withCasts values lost #206

@guilheb

Description

@guilheb

I believe PR #202 introdudes a bug with the handling of withCasts.

More precisely, on line 100 of file src/JoinsHelper.php, a new model is created

$query->setModel($model = new $originalModel());

If $model has anything in its casts property (that was defined with a withCasts), it is not preserved when a new model is passed to setModel().

I'm not sure if it's the right solution, but adding this instruction right after seems to solve my problematic scenario.

$model->mergeCasts($originalModel->getCasts());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions