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

  • Home
  • SEARCH
  • 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 6178475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:27:45+00:00 2026-05-24T00:27:45+00:00

THE QUESTIONS: What I do need to know is how I should go about

  • 0

THE QUESTIONS: What I do need to know is how I should go about incorporating a different database (mongodb) into ATK4?
Specifically:

  1. Should I just create a connection to the database and have the crud in every model, or should I abstract it into a library?
  2. If I abstract it into a model, how would I call the methods from inside the model?

Some notes:

  1. in .net, the obvious answer is to abstract it, which I’ve done on my projects using mongo and asp.net mvc, but I’m a total noob when it comes to php, so I’m not sure what the conventions are.
  2. Code Igniter makes it real easy to load libs, I’m wondering if ATK4 is the same way?
  3. I’ve read through all of your documentation and skimmed through the tutorial under the beta documentation.

Some things about me: I am a total noob at php. My primary coding framework is .NET (both vb&c# (winforms and asp (both webforms and mvc)))

I’ve been playing around with CodeIgniter and like it a lot. A coworker of mine asked me to check out ATK4 and I must say I’m impressed with what I’ve seen so far.

However, if I’m going to adopt ATK4 for my projects I need to be able to use MongoDB. Let me make this clear: I’m not asking for anyone to write the code for me. I just need some guidance on php and atk4 conventions. The documentation on the website about those things are a bit sparse at the moment (non existent).

  • 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-24T00:27:47+00:00Added an answer on May 24, 2026 at 12:27 am

    You have two choices, both abstracted. First involves in creating Models and Controllers which Grid and other views would automatically recognise. With second, you would need to fetch data from MongoDB and insert into a static table.

    Mongo-aware Views

    This approach requires that you know how models operate. Particularly you’ll need to understand MVCGrid, setController, setModel as well as mvc/Controller.php. You then would need to create your own controller. You would then need to have copy of AbstractView::setModel() which uses YOUR controller, which will properly know how to fetch data from MongoDB.

    Also you would probably need to extend Grid (or MVCGrid) to properly stream data.

    Once you have this done, you can do this:

    $form->setMongoModel(‘MyModel’)->loadData(123);

    (if you are using GIT version, you can actually inject this method:
    https://github.com/atk4/atk4-testsuite/blob/master/page/core.php#L108

    Semi-automated approach

    In this approach you would need to load data from your MongoDB controller yourself and feed it into the grid or form. Both Grids and Forms can work with static data just fine. In this case you would need something like this:

    $c=$this->add('MongoController');
    $data=$c->load($my_model,123);
    $grid->setStaticSource($data);
    

    Answers to your other questinos

    Code Igniter is nice framework, but it instantiates objects globally. It’s unlikely you would need 2 instances of same library. Agile Toolkit permits that and Controllers are often used like that. As a result you are pretty much in charge of data management in CI while in ATK4 objects bind to each other. It’s the core difference between approaches in those libraries.

    Library in CI:

    $this->load->library('MyLib');
    

    in ATK4 would look like this:

    $this->api->add('MyLib');
    

    It’s common practice to place

    $this->owner->mylib=$this;
    

    inside your libraries, so it’s easier for you to access them.

    You might be better off without knowing how PHP development happens, it’s in most cases very reliant on HTML templates.

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

Sidebar

Related Questions

I know my question isn't about programming problem, I just need a suggestion to
I know, there are many different questions and so many answers about this problem...
I know it is a general question but I need your recommodations about a
I have different questions about a full architecture idea. I hope someone with great
I've read several questions about storing images in a database as opposed to folders
For the 99 Haskell questions, specifically the 23rd one, I need to Extract a
I just started thinking about creating/customizing a web crawler today, and know very little
I know there are plenty of questions about 3d rotation that have been answered
I don't really know about C. So, my questions and ideas may be misleading
First of all, I know there is a lot of questions about this topic.

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.