0

It was not time ago that I realized that those that I consider standards for MVC implementation with PHP are not standards for all. I would be very happy to read different approaches of how to implement MVC architecture with PHP, not just frameworks but the all idea that you are acquainted with and prefer. Not just frameworks but the logic that you accept as the clean one.

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by jkon
0

Write a base class with database anything , for M

Smarty for V

Based on your db class, write the code according to your needs for C

0

Well model is model so it should have layers (that if you drew an UML diagram could make sense) … in my point of view you have obviously the db layer witch has the statements and the functions to use them and return result set , array of results or true false or a single string answer and assigners (that collects data from deferent (if needed) db objects and file system) in order to assign values to an object or generate a list of objects.

0

To be more accurate a db object has only the connection to the database.. All other works should be done by workers classes of this db object.

0

the base db class is all of db operation
{
connection
no result query
single result
result set
transaction
close
......
}

do u know db abstract???????????

0

This is one approach that you mention zark_yoc one other is to have an instance of a db object (could be a child of PDO with what ever methods could do your life easier) and pass it through data operation – workers classes if used directly through controller.

One other logic if you have complex operation logic or even if you want to retrieve list of objects is adding one additional layer of assigners. Passing the instant of the controller (and therefore the available db objects) could use any resource (e.g. file system) or data workers and business logic in order to assign values to an object or a list of objects.

As I wrote I understand that there are many deferent MVC approached to PHP and I am not claiming the best one in any case. I just started this thread in order to have a discussion about these approaches.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.