Simple Entity Framework with SQL-Generation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Roemer
Forum Newbie
Posts: 1
Joined: Fri Jan 06, 2012 5:14 pm

Simple Entity Framework with SQL-Generation

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Simple Entity Framework with SQL-Generation

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Simple Entity Framework with SQL-Generation

Post 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.
(#10850)
Post Reply