Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1007021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:33:14+00:00 2026-05-16T08:33:14+00:00

I have a domain for users that connects to my user table, which includes

  • 0

I have a domain for users that connects to my user table, which includes information like username, first name, and last name.

Then I have a domain for emails, that connects to the email table because a user can have more than one email. The email table consists of a fk to connect the user with their emails, and other fields like address, status, etc.

Should I have different domains for the separate tables, but combine functions, that call the domains, in the models? Or maybe you can but it’s not best practice.

I am new to this MVC thing and it’s hurting my brain right now. Maybe, it just someone hasn’t explained it well enough.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:33:14+00:00Added an answer on May 16, 2026 at 8:33 am

    Question: when you mention having a “Domain”, are you referring to a User model, and an Email model? or to the design pattern?

    Also, initially (but depends on your application) having the email database logic inside the users model is more logical (to me), since I don’t think you are going to add email addresses without creating a user. That is, the email model really depends on the user model, and perhaps only on the user model, so maybe they should be combined?

    The way I would do it:

    1. Put all the database logic inside the models which I assume is the way you have done it.

    2. Create a library or class to place the business logic of the application that concerns users. (For example, uploading an image, or connecting to a web service, should not be in the model if you follow the standard that CodeIgniter models should only contain database logic, so that’s why I create another class to handle those cases)

    3. Now, when you want to create an user, you just inject the models in the library (you could do this at the controller level), and call your abstract method create_user()

    class Users extends Controller {
        public function create() {
            // these could be in the constructor!
            $this->load->model('users');
            $this->load->library('users_logic');
            $this->users_logic->set_model($this->users);
            // and/or: $this->users_logic->set_email_model($this->email_model);
    
            if ($this->input->post('name')) {
                $this->users_logic->create();
            }
        }
    }
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET application that's trying to copy a file to a remote
I have a need to be able to identify all of the users on
Our client's site currently uses forms authentication, so users have to go to the
We’re considering using WIF for authenticating our users, so I’ve started to gather some
Let me start by saying, I am new to Java programming. I have coded
I've written an ASP.NET 2.0 web service which is consumed by a web application
I want to give access to certain data, in various databases on a single
I asked a question a few days ago ( Access to SQL Server 2005
I'm currently working on an FTP client written in C, and it's working pretty

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.