Welcome Guest, Not a member yet? Register   Sign In
MVC with Mapper-Class
#1

[eluser]htheus[/eluser]
Hi everyone

I am kinda a CI-Newbie. My question is: Anyone is using Mapper-Classes with CodeIgniter?
My "basic OO-architecture with Mapper-Classes" would look like this:


- FrontController: index.php uses a FrontController which loads another spcific Controller (contact, about me, etc)

- Controller: Every specific controller implements the domain logic (business logic). The controller loads the specific Mapper-Class (not the Model!).

Example: $myMapperObj = new UserMapperObj("{$model_name}");

- Mapper (additional layer): It's main task is to map data (any kind of source) on an object. The abstract SuperClass Mapper() loads the module $module_name. The specific Mapper-Class implements its and so inherits also the instance of the model class. The specific Mapper-Class implements the use-cases specific querys like getOverview(), getLastVisitors(), etc.. The Mapper-Class returns an mapped object.


- the Model implements the _set() and -get()-Methods plus __construct() ONLY and represents the abstraction layer between the data source and the application itself (In case that the data source is a MySQL-DB, the Model inherits all methods of the CodeIgniter-Database Class).

- View: The Controller sends the necessary data (MappedObject) to the view

Any idea to improve that architecture? Or anyone has a better idea to integrate Mappers ;-) ? Is there any best practice for CI?

Thx in advance for your replies.
Greetings from Zurich!


PS: Sorry for my bad english Smile


Messages In This Thread
MVC with Mapper-Class - by El Forum - 02-27-2012, 02:52 AM
MVC with Mapper-Class - by El Forum - 02-27-2012, 03:09 AM
MVC with Mapper-Class - by El Forum - 02-27-2012, 05:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB