Welcome Guest, Not a member yet? Register   Sign In
NTier architecture and CodeIgniter
#1

Hello everyone!

Firstly, let me thank all of you volunteers who are in this forum, this is such an amazing and underrated framework!

I've got an architecture question which has been bugging me for a small while here.
Recently, I have been working on a huge (work) project which uses the N-Tier architecture, and I am now confused on its DTO and DAO aspect within CI.

For those unfamiliar with the ntier architecture, here is a quick summary of both those terms. 
A DTO, which stands for Data Transfer Object, is what should be returned by the models. 
 It does not contain accès to the database, as this logic is in the DAO.
A DAO, which stands for Data Access Object, which is whatever method you use to access your data.

In my case, I'm trying to port my user login to such an architecture, with typed data.
In CodeIgniter, I would call my users model and use a method such as getUserFromId($id), where the model would act as DAO and return a DTO. 

As I'm working towards having a lot of abstraction, here is how I currently planned on structuring my folders:


 - Models
 |-- IUserDAO
 |-- MariaDB
    |-- UserDaoImpl
 |-- DTO
    |-- IUser
    |-- Impl
       |-- UserImpl

As you can see, this doesn't seem very clean.
It feels wrong to have the DTO folder inside the Models folders, yet I can't seem to find a better place.

In a usual project, I would have both a DTO and DAO folder but there does not seem to be such a predefined folder in CI. 
Perhaps I should create it, but I preferred asking here first Smile

Update: While writing this post, I've had a quick look in newmythmedia's blog and it seem Entities would solve my problems.
Leaving this question up if I'm mistaken 

On an unrelated note, here are few other questions not worthy of a post themselves I'd like to ask:
 - Are there any medium-big open-sourced projects using CI?
    I'd like to navigate into the architecture of decently-sized projects for inspiration.

 - CI4: While I only had a quick glance over the proposed changes, would you recommend waiting for CI4 until making an architecture revamp (which would take few months) or waiting until it is out before attempting this change?
Reply


Messages In This Thread
NTier architecture and CodeIgniter - by antony - 04-18-2017, 06:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB