Best Practises for separation of Frontend / Backend

I am building a web application which is divided in a frontend website and a backend website both build with Yii of course. I do this separation for making it easier to develop my .NET and Mobile Apps at the same time consuming the same services like the website.

The backend has no "site/index"-controller-action. For getting the data from the backend I have written appropriate controllers on the backend that provide the SOAP services.

Now my questions:

  1. when i consume the backend soap services, should i write an own frontend-model class appropriate for every backend controller class or should i put the consuming directly into the frontend controllers?

  2. Is there an easy way to map the functions of a model of the backend to a model in the frontend?

create a module for the back-end

thanks for this incredibly detailed answer. ;D

sorry I thought you just wanted to know what is best practice for back-end

ok here

  1. you create a separate back-end to manage you data and entries.

  2. sure you can use the same models just add them in your main config file


'import'=>array(

		'application.models.*',

		'application.components.*',

		'application.modules.backend-module-name.models.*',

	),

you should try and keep it dry one of the convention yii uses

[color=#1C2837][size=2]

[/size][/color]

[color=#1C2837][size=2]

[/size][/color]

I already have created a backend (is on one server) and i have a frontend on another server.

[color=#1C2837][size=2]

[/size][/color]

Re: I don’t understand - how can i use a model in Yii that is on another server…?

My problem is that i would like to use the scaffolding features like the CRUD-generator for the data in the backend but available for the frontend. How can i get the Backend-Webservice into the ActiveRecord of the Model that the Gii requires for getting the data in order to build the edit forms?

you cant use the models that are on a separate server you have to create the models

you can use same database and read the data and create the models according to your back-end schema

That is what i was concerned about… more work ;D… Maybe it would be a good feature for the Gii tool. Building frontend and backend controllers for interacting via REST or SOAP… that would make it much easier to build a website and provide a same time the interfaces for mobile apps…