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 952977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:58:38+00:00 2026-05-15T23:58:38+00:00

This project is in PHP, but is fairly language agnostic. I’m building a project

  • 0

This project is in PHP, but is fairly language agnostic. I’m building a project that has the following MVC format

Main_Class
Main_Class_Common
  --> Class_A
  --> Class_B
  --> Class_C
  --> Class_...
  --> Class_K

Original requests go to the Main_Class which then includes the appropriate main sub class. The majority of a request will only need to access data in it’s own class. However, there is a small bit of cross-class data. All sub classes need access to shared common functions in Main_Class_Common at all times.

For example,

Main_Class
Main_Class_Common
  --> Class_Projects
  --> Class_Clients

Usually, Class_Projects never needs data from Class_Clients except in one function it might need to call $class_clients->get_client_details($client_id); and the same occasionally happens in the reverse.

But both classes need to be able to call $main_class_common->clean_input($myinput);.

Currently, I’m using Class class_a extends main_class_common() for access to shared functions which works perfectly. But is the best way to access Class_B from Class_A to just access the global $class_b variable occasionally or should I move the possible shared functions into the Main_Class_Common even though they are used only occasionally?

The project right now is in the early stages of dev, so the current implementation can be changed easily.

  • 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-15T23:58:39+00:00Added an answer on May 15, 2026 at 11:58 pm

    The repository pattern would fit in here. Create a Class_ProjectRepository class and Class_ClientRepository class, that contain methods such as get_client_details($client_id).

    The MVC controller classes will make use of the repositories. For example, both Class_Projects and Class_Clients can use the Class_ClientRepository to retrieve client details.

    The repository classes will build the query and call your DAL. Additionally, if you need actual domain objects such as Class_Client in your controller, you should also make the repositories responsible for transforming the DAL result sets into domain objects.

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

Sidebar

Related Questions

I am working on a small project for learning PHP better. This project has
I'm new to both XML and PHP but I have this project and this
I've just downloaded the nailthumb project from http://www.garralab.com/nailthumb.php but I cant call this function
I am working on this PHP project and I have many places that an
So I have this project in PHP where I have some include files next
When I update my Symfony2 project I always have to do this: root@xxx:/var/www/project# php
Hi I am doing my project in PHP.In this when the use r doesnt
I have this problem getting my newly created php project on Netbeans work on
I'm using this plugin: http://www.jeremymartin.name/projects.php?project=kwicks And my code follows this example: http://www.jeremymartin.name/examples/kwicks.php?example=7 I'm using
The html of this script is made with list items http://www.jeremymartin.name/projects.php?project=kwicks Where can I

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.