PHP Classes

Totally Agree With You on Thin Models

Recommend this page to a friend!

      Tiny PHP ORM Framework  >  Tiny PHP ORM Framework package blog  >  PHP ORM Pros and Cons  >  All threads  >  Totally Agree With You on Thin Models  >  (Un) Subscribe thread alerts  
Subject:Totally Agree With You on Thin Models
Summary:That's why I wrote a light-weight orm
Messages:2
Author:A Ade
Date:2016-06-09 01:19:06
 

  1. Totally Agree With You on Thin Models   Reply   Report abuse  
Picture of A Ade A Ade - 2016-06-09 01:19:06
I developed and currently maintain a web application using the SolarPHP Framework back in 2010. The application is still being used and is currently in the process of being rewritten. One of the pain points in the current application is performance when using SolarPHPs ORM component Solar_Sql_Model ( http://solarphp.com/apidoc/package.Solar_Sql_Model ) to retrieve data from the database (especially when there are a lot of related records / entities involved). I've worked with Paris Orm ( http://paris.readthedocs.io/en/latest/ ) a bit and I really like how light-weight it is but I don't like the Active Record pattern it's based on; it's just not going to work with the SolarPHP web app in question because of the way Active record combines Data access logic with business logic.

I'm currently in the process of rewriting this web application and I have decided to go with a micro PHP framework (in this case Slim 3) and other relevant composer packages (I am no longer a fan of Full Stack Frameworks like Zend, Symfony, Laravel and the likes; because they force you to adhere to their way of doing things and rewriting applications based on these kinds of frameworks is never a trivial task). I extended Slim 3 and added MVC capabilities to it ( https://github.com/rotexsoft/slim3-skeleton-mvc-app ). I am super excited about PSR 7 and hoping to have my controllers be portable so that they can easily work with any framework (preferably micro) that supports PSR 7 request and response objects.

In the spirit of using as little framework code as possible I also wrote a lightweight ORM / Data access package called LeanORM ( http://rotexsoft.github.io/leanorm/ ) which contains what I believe to be the very basic data retrieval features needed and can be easily extended to do more complicated things and can be also augmented with other composer packages like phinx ( https://github.com/robmorgan/phinx ) for database migrations, Aura Filter ( https://github.com/auraphp/Aura.Filter ) for sanitization and validation etc. LeanORM also exposes its underlying PDO object so that you can directly run SQL queries using the PDO approach. LeanORM is flexible in the it can return data to you as associative arrays (including relationship data) and if like dealing with objects you can make it return Collections and Records. I wrote a base abstract package called "Generic Data Access Objects" (GDAO https://github.com/rotexsoft/gdao) which is what LeanORM is based on.

At the moment LeanORM is usable but I still need to write unit tests and implement a few more features and also improve the documentation.

Once again, thanks for writing this article and I will definitely take a look at TinyORM.

Have a good one.

  2. Re: Totally Agree With You on Thin Models   Reply   Report abuse  
Picture of Victor Bolshov Victor Bolshov - 2016-06-09 14:50:53 - In reply to message 1 from A Ade
Thank you for sharing this information. In turn, I will definitely take a look at your projects!