Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
API Controller -> Model layer
  • Hey all, I'm building an app with a number of rest apis that feed into orm models. I'm considering different strategies to abstract the layer that: 1) receives the data from the input obj,
    2) validates/sets defaults,
    3) then inserts/updates. I'm looking for a good pattern that abstracts this cleanly and keeps good separation of model and controller responsibilities. Currently, all of my rest apis extend my custom Controller_Api_Base, which extends Controller_Rest. I'm thinking of creating a getFromInput() function that looks through the Input values, compares them with the list of fields from the model, fills in defaults, then creates and returns the model. Anyone have thoughts on this layer or know of any examples I can look at? Thanks in advance,

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!