-
-
Notifications
You must be signed in to change notification settings - Fork 449
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
Swap model constructor parameters around #8
Comments
Another alternative is to get rid of non dependencies from constructors. Ie something like $project = new Project($client);
$project->load(1); etc... Edit: I like this better. |
I would agree on switching the arguments order. However I would still leave the current params in, but have them as optional
This gives the ability to create a Model instance with great flexibility over how/when you fetch/override the data. I would also suggest that each Model has it's own hydrate method so we can remove the logic of (in the example of Project) the User::fromArray/ProjectNamespaces::fromArray calls out of the constructor. |
I would also suggest this happens before the next re tagging, since it would be a major bump and breaking changes are acceptable. |
I think the plan is to remove models (eventually). We can close this off for now, since any refactoring tasks relating to models is not going to be worth it. |
IE
instead of
This would make
$client
mandatory but it is always passed anyway so do not see any disadvantages to this.The text was updated successfully, but these errors were encountered: