Skip to content

noobhacker/EntityFrameworkForPHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EntityFrameworkForPHP

Simple QueryBuilder like ASP.NET Entity Framework. alt_text

I created this layer for my own project use and I find it very useful. This is not a super big many function framework but I build the crucial features for simple LINQ operation.

alt_text

Few reasons I didn't apply lambda expressions

  1. Reflection in php? There is no way to parse .where(x => x.id == 1) into values, it will directly turn into boolean.
  2. There is no => arrow in php, if you want lambda it would look like

.where(function ($x) { $x.id == 1 }; ); //which is nonsense

alt_text

Package includes

  • Core DbSet code file for query builder and 1 BaseContext for mysqli $conn DI.
  • Template for DbContext and DbSet, since there is no DbSet<> in php you have to extend DbSet
  • NO $db->saveChanges(), this is only query builder that looks like Entity Framework.

alt_text

Database naming conventions

  • Table name -> plural
  • Primary key -> id
  • Foreign key -> target_table_id

The join demonstrated above is for one to many only. I will do custom join like the one in C# if my project needs it.

About

Simple QueryBuilder like ASP.NET Entity Framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages