Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>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. </p> <p><strong>Mongo-aware Views</strong></p> <p>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.</p> <p>Also you would probably need to extend Grid (or MVCGrid) to properly stream data.</p> <p>Once you have this done, you can do this:</p> <p>$form->setMongoModel('MyModel')->loadData(123);</p> <p>(if you are using GIT version, you can actually inject this method: <a href="https://github.com/atk4/atk4-testsuite/blob/master/page/core.php#L108" rel="nofollow">https://github.com/atk4/atk4-testsuite/blob/master/page/core.php#L108</a></p> <p><strong>Semi-automated approach</strong></p> <p>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:</p> <pre><code>$c=$this-&gt;add('MongoController'); $data=$c-&gt;load($my_model,123); $grid-&gt;setStaticSource($data); </code></pre> <hr> <p><strong>Answers to your other questinos</strong></p> <p>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.</p> <p>Library in CI:</p> <pre><code>$this-&gt;load-&gt;library('MyLib'); </code></pre> <p>in ATK4 would look like this:</p> <pre><code>$this-&gt;api-&gt;add('MyLib'); </code></pre> <p>It's common practice to place </p> <pre><code>$this-&gt;owner-&gt;mylib=$this; </code></pre> <p>inside your libraries, so it's easier for you to access them.</p> <p>You might be better off without knowing how PHP development happens, it's in most cases very reliant on HTML templates.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload