Welcome Guest, Not a member yet? Register   Sign In
Load a controller into another controller
#5

(08-13-2019, 08:24 AM)albertleao Wrote: Loading a controller from another controller breaks the MVC pattern and generally isn't the best practice. Controllers are really just supposed to pick which data you're displaying from your back end and sending it to your frontend.

I'd recommend writing a few services or libraries and moving all that facebook code in there. Then when you have that, call the library/service from your controller. This makes it so that you can pull that library from anywhere fairly easily, and makes it so that you can unit test each library and mock out your api calls.

I seen other sites talk about adding libraries but I wanted to come here and get more insight. I think doing the service/library route in the best option! Heart
Reply


Messages In This Thread
RE: Load a controller into another controller - by Mekaboo - 08-13-2019, 11:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB