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

CRUD - add if model is loaded.. #362

Closed
romaninsh opened this Issue Feb 5, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@romaninsh
Copy link
Member

romaninsh commented Feb 5, 2018

CRUD's add form will do editing action if model is loaded:

$model->loadAny();
$crud->setModel($model);

Solution would be to add unload() into setModel(), it would only mess things up anyway.

@FabulousGee

This comment has been minimized.

Copy link
Contributor

FabulousGee commented Mar 9, 2018

Can you clarify what's the issue here, please?

I load a model with LoadAny (so I get a real model or a new empty model as return, right?). I hand this over to the CRUD and the CRUD wants to edit the new empty model as well instead of creating it?
Or did I get this wrong?

@DarkSide666

This comment has been minimized.

Copy link
Member

DarkSide666 commented Mar 11, 2018

CRUD should no care about is record loaded in model or not.
Maybe CRUD setModel() should even clone model and unload. Or just unload model.

@romaninsh

This comment has been minimized.

Copy link
Member Author

romaninsh commented Apr 1, 2018

just unload is fine.

@DarkSide666

This comment has been minimized.

Copy link
Member

DarkSide666 commented Apr 3, 2018

Already implemented here: https://github.com/atk4/ui/blob/develop/src/CRUD.php#L107
So this issue can be closed.

@DarkSide666 DarkSide666 closed this Apr 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment