'Data entity object' and PHP
Posted: Sun Nov 06, 2005 4:31 pm
Hi everyone,
With the release of PHP 5 developing PHP applications using an OOP approach is getting more and more interesting. I would like to read your opinions regarding to what extent OOP should be implemented. My regular approach is the model-view-control one. I use the Smarty template engine to separate the business logic from the presentation logic and within the business logic layer I usually separate the paging business logic (handling the post actions, headers and template assigning and parsing) on the one hand and the model modifier business logic (inserting new records in the databae, selecting records etc.) on the other.
I have quite some experience in the field of web development using Java and within the Java environment it is common to use so called Java beans to describe data. For example a datasource table named User which describes the properties of a system user should be used within the Java environment as a bean that has the exact set of properties as variables that can be retrieved and set by the business logic.
At this moment, within PHP, I use array's to 'transport' database data within the application, but I was wondering to what extent the Java approach, I just described, is suitable within the PHP environment. In other words: is it a good practice to create a class for every database entity to work with within the business logic layer?
Thanks in advance!
Jeroen
With the release of PHP 5 developing PHP applications using an OOP approach is getting more and more interesting. I would like to read your opinions regarding to what extent OOP should be implemented. My regular approach is the model-view-control one. I use the Smarty template engine to separate the business logic from the presentation logic and within the business logic layer I usually separate the paging business logic (handling the post actions, headers and template assigning and parsing) on the one hand and the model modifier business logic (inserting new records in the databae, selecting records etc.) on the other.
I have quite some experience in the field of web development using Java and within the Java environment it is common to use so called Java beans to describe data. For example a datasource table named User which describes the properties of a system user should be used within the Java environment as a bean that has the exact set of properties as variables that can be retrieved and set by the business logic.
At this moment, within PHP, I use array's to 'transport' database data within the application, but I was wondering to what extent the Java approach, I just described, is suitable within the PHP environment. In other words: is it a good practice to create a class for every database entity to work with within the business logic layer?
Thanks in advance!
Jeroen