Skip to content

Expected beforeSave() return value to let save go through? #7996

Open
@mehov

Description

@mehov

In some cases, a beforeSave() callback may want to let the save continue without changing the entity.

Documentation at https://book.cakephp.org/5/en/orm/table-objects.html#beforesave does not say what value to return early to accomplish that.

In my case if (something) {return;} works, but I'm not sure if that's the best/recommended way to do it. It could well be, as https://api.cakephp.org/5.0/class-Cake.ORM.Behavior.Translate.ShadowTableStrategy.html#beforeSave() says it's "Returns: void" by default.

Do you think it may be a good idea to explicitly clarify that in the Book for beforeSave() and maybe others?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions