Ad

Code First Entity Framework Model In PHP

I am recently working in a ASP.Net MVC project where we use code first technique to create all the database table. I really liked the idea, where you don't need to touch the database and create the model classes which are automatically mapped to the database by the EF layer.

I am planning to start a hobby project with PHP and was playing with Laravel (I am newbie in PHP). I was wondering if there is any equivalent framework in PHP that support code first pattern as EF 4.1?

I was looking into some Laravel tutorial, it looks like the ORM (eloquent) doesn't work exactly same way as the EF 4.1 in .net does. I seems to me that you still need to create the table in the database and then you create a model to map the database. Am I missing something?

Thanks.

Ad

Answer

For PHP i suggest looking at Doctrine 2 as ORM. You define your Entities and doctrine will generate the classes and database structure for you.

Ad
source: stackoverflow.com
Ad