Yii Framework Forum: Best Practises for separation of Frontend / Backend - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Best Practises for separation of Frontend / Backend Rate Topic: -----

#1 User is offline   Bravolito 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 09-August 12
  • Location:Berlin (Germany)

Posted 10 August 2012 - 08:16 AM

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?
0

#2 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 966
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 10 August 2012 - 08:23 AM

create a module for the back-end
0

#3 User is offline   Bravolito 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 09-August 12
  • Location:Berlin (Germany)

Posted 10 August 2012 - 08:28 AM

thanks for this incredibly detailed answer. ;D
0

#4 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 966
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 10 August 2012 - 08:47 AM

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
0

#5 User is offline   Bravolito 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 09-August 12
  • Location:Berlin (Germany)

Posted 10 August 2012 - 08:56 AM

Quote

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



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

Quote

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


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?
0

#6 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 966
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 10 August 2012 - 09:05 AM

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
0

#7 User is offline   Bravolito 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 09-August 12
  • Location:Berlin (Germany)

Posted 15 November 2012 - 05:19 AM

View Postalirz23, on 10 August 2012 - 09:05 AM, said:

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..
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users