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

Database Interface Layer concrete example #159

Open
hokrc01 opened this issue Dec 5, 2018 · 1 comment
Open

Database Interface Layer concrete example #159

hokrc01 opened this issue Dec 5, 2018 · 1 comment

Comments

@hokrc01
Copy link

hokrc01 commented Dec 5, 2018

Does anyone have a or know of a concrete example of php code that would reflect "Clean Architecture" page 166 figure 17.1. I simply can wrap my head around it?

the attached code represents examples of what I have written so far, but I know this will not work for anything but a SQL database. In my example My use case is simple, I am trying to have a use log into the system. Please ignore my namespace names as I am trying to rework my code from a homemade "MVC" framework. Finally the view component was not included because it is trivial, it send a json string.

Thanks
ken

Login Code.zip

@peter-gribanov
Copy link
Contributor

peter-gribanov commented Dec 6, 2018

You have a lot of problems in the code.

  • Many principles described in this project are not followed.
  • Validation rules are more appropriately move from the controller on a separate layer.
  • Do not forget about the principles of a thin controller and a thick model.
  • Your model is similar to ActiveRecord, which is anti-pattern and contrary to the principles of DDD.

I recommend to look at Doctrine ORM.
And I recommend not to invent your own, but to take a ready-made frameworks, for example, a Symfony. In frameworks, much of what you are doing is already implemented. The frameworks teach programming culture and instill best practices, although some of them are controversial.

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

No branches or pull requests

2 participants