• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Models as Entities using PHP Traits

A feature that I didn't know about until about 1 year ago in CI was the ability to have the database results returned as any class that you can set the attributes on. I've become a big fan of the Repository pattern, myself, and that helped make it all work together pretty seamlessly.

That way you have the user_model which handles mainly working with the database to find, save, etc the data. Then entity classes, just like you've mentioned have zero parent classes and are completely standalone.

Oh - and this absolutely made it's way over to CI4.

Messages In This Thread
Models as Entities using PHP Traits - by prezire - 08-01-2016, 09:28 AM
RE: Models as Entities using PHP Traits - by kilishan - 08-01-2016, 11:38 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.