Skip to content
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

allow default values of attributes to be initialized in class #1

Open
Raaghu opened this issue Jan 6, 2018 · 0 comments
Open

allow default values of attributes to be initialized in class #1

Raaghu opened this issue Jan 6, 2018 · 0 comments

Comments

@Raaghu
Copy link
Member

Raaghu commented Jan 6, 2018

Currently there is no way to set default values for fields ,
Enhance Model::create api to consider the value of field from $data argument only if present in $data , otherwise the value should be considered as the value of that field in the instance (can be null or any other value)

class A {

private $f1 = null; // default value is null, if schema does not allow null , then create should fail by throwing BadQueryException
private $f2 = "enabled"; // default value is enabled

// ..... 

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant