Welcome Guest, Not a member yet? Register   Sign In
Very new to all this, have a few questions
#1

[eluser]bcnd[/eluser]
I'll start by saying I don't have much PHP experience which I realize is a handicap going in. I'm tasked with creating a UI that interfaces with a RESTful service, pulling in a JSON array, editing it, and sending it back.

I'm fine with the UI and how to edit the JSON, but I'm a little confused how this workflow falls in to the MVC pattern. I've been playing around with Phil Sturgeon's REST Controller and have been able to push around JSON, but a lot of that has to do with populating my views with data from my own internal models. I'm not going to be doing that (my data is given to me by my REST app), so am I correct in assuming I don't need to worry about the Model aspect?

I'm trying to wrap my head conceptually on how to approach this. Here's my current thought, but I'd love someone to shed any additional insight:

I'm thinking my Controller will use my REST Controller to GET the URL, and return the JSON array. Then, I will be displaying it in my View. I can manipulate it via JavaScript or whatever, and then once I have my newly edited array, I submit it via a form that uses another Controller to PUT the JSON back to the REST app.

Does that sound correct?
#2

[eluser]bcnd[/eluser]
Anyone? Even just pointing me in the right direction would be great.
#3

[eluser]elite-board[/eluser]
the Model generally is just to house any logic, which if your REST app does that, then your all set.

what you described sounds good to me. You could use the model to interact with the REST app

hope this helped.
#4

[eluser]wehappyfew[/eluser]
[quote author="elite-board" date="1334277665"]the Model generally is just to house any logic, [/quote]

I disagree....the Controller holds the logic in an MVC framework.

If you have your data pulled from whatever source then you 'may' not need a model .
The model is there to interact with a datasource and return to you the results.

From what i understand the only thing you need to do is the organizing .
The views are going to display the data.
The controller(s) take the results returned from the model and send them to the views.
The model holds all the database interactions....in your case the data are coming from a RESTful source.
#5

[eluser]bcnd[/eluser]
Thanks guys... it helps getting some reassurance I'm not going about this the whole way.

I'm sure I'll have a ton more questions as things progress!




Theme © iAndrew 2016 - Forum software by © MyBB