Page 1 of 1

Simple Entity Framework with SQL-Generation

Posted: Fri Jan 06, 2012 5:27 pm
by Roemer
Hi All
I'm working on a small php project where I need some Selects/Inserts/Updates/Deletes from a MySQL database and since I don't like to write SQL by hand, I took the time to create a simple Entity Framework with handles this for me.

I deployed the whole thing on google code:
entitydataaccess - Generic Entity Data Access - Google Project Hosting

Please have a look at it and tell me your thoughts!

Small introduction:
You have to create your entities as classes according some guidelines, then you can create simle queries like those here:

Code: Select all

// Get all entities from a table (sorted by the primary key here)
$query = new EDAQuery();
$query->AddOrder(MarkerColumns::MarkerID, EDASortDirection::ASC);
$entityList = EDAEntityHandler::GetEntityList('Marker', $query);
 
// Get an entity by a field (primary key here)
$query = new EDAQuery();
$query->Add(new EDAEq(MarkerColumns::MarkerID, $entityID));
$foundEntity = EDAEntityHandler::GetEntity('Marker', $query);
The exact guidelines and possibilities are written on the google code project site.

Cheers and I'd really appreciate to get some feedback from you!
Roemer

Re: Simple Entity Framework with SQL-Generation

Posted: Fri Jan 06, 2012 9:14 pm
by califdon
You have obviously done some careful research and work, and I always admire that. I wonder, however, why someone would feel the need to invent an alternative way to avoid using such a firmly established, well understood, flexible language as SQL. Perhaps with more study and thought I could be persuaded that there is a need for it, but at the moment it strikes me as a solution in search of a problem. But that's only my perception.

Re: Simple Entity Framework with SQL-Generation

Posted: Sat Jan 07, 2012 2:25 am
by Christopher
Looks interesting. You may want to follow PEAR naming or namespace to make it autoloader friendly -- so names like Eda_Query, Eda_Marker_Columns, Eda_Sort_Direction, Eda_Eq and Eda_Entity_Handler.