Usually, every table in the database is associated with an entity class. The entity class will mostly have all table columns as an attributes. For each attribute, there must be a public function to set and get the value of the attribute. Currently, the library has a way to map a select result to an entity class. The issue is that the entity class must be created manually by writing the whole entity class's code.
Suggested Solution
As I have said, each database table is usually mapped to an entity. If this is the case, why don't we have a method in the class MySQLTable Which can be used to create the entity class automatically? This would reduce the development effort a lot.
The method signature would be as follows:
Method name: createEntityClass
Method parameters:
Name: $options. Type: array
Returns: boolean
The options array should be an associative array. It can have the following indices:
path: The location at which the entity class will be created inside.
name: The name of the entity class.
namespace: An optional namespace that the entity class can be added to.
More options can be added in the future to customize the created entity class.
Problem
Usually, every table in the database is associated with an entity class. The entity class will mostly have all table columns as an attributes. For each attribute, there must be a public function to set and get the value of the attribute. Currently, the library has a way to map a select result to an entity class. The issue is that the entity class must be created manually by writing the whole entity class's code.
Suggested Solution
As I have said, each database table is usually mapped to an entity. If this is the case, why don't we have a method in the class MySQLTable Which can be used to create the entity class automatically? This would reduce the development effort a lot.
The method signature would be as follows:
createEntityClass
$options
. Type:array
boolean
The options array should be an associative array. It can have the following indices:
path
: The location at which the entity class will be created inside.name
: The name of the entity class.namespace
: An optional namespace that the entity class can be added to.More options can be added in the future to customize the created entity class.