Skip to content

Implement a basic Object Mapper with DataTable #16

@rafaelnajera

Description

@rafaelnajera

With attributes. A DataTable becomes an ObjectTable:

class MyObject {

 [#\Id(bigint)]
int $id;

[#Column('some_string', 'varchar(128)')]
string $someString;

[#Column('some_date', 'datetime(6)']
string $someDate;

...
}

Then instead of createRow, getRows, etc

storeObject(int $id, object $myObjectInstance);
getObject(int $id): object; // returns a true MyObject instance, not a stdObject
...

During construction the mapper gets the column to property map using a Reflection class.

It could even check that the database table is properly constructed or generate SQL code to create the table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions