Harts
Harts

Reputation: 4093

Cakephp route all model to different name

I'm not quite sure how to do this, I'm not familiar enough with cakephp routing.

Basicly, I have model like: Contact and Project. However, after redesign and redevelop and using the same stuff but different term..

I need to change something like:

myapplication.com/contacts/add  --> myapplication.com/customers/add
myapplication.com/contacts/edit --> myapplication.com/customers/edit
myapplication.com/projects/add  --> myapplication.com/tasks/add
myapplication.com/projects/edit --> myapplication.com/tasks/edit

or any other view. How should I do this?

I know standard way:

Router::connect('/dashboard', array('controller' => 'projects', 'action' => 'dashboard'));  
Router::redirect('/projects/dashboard', '/dashboard');

I believe I can do it one by one, but that's not very intuitive.

Upvotes: 0

Views: 73

Answers (1)

floriank
floriank

Reputation: 25698

Try this.

Router::connect('/customers/:action', array('controller' => 'contacts'));  
Router::connect('/tasks/:action', array('controller' => 'projects'));

It might be also a good idea to read this section about routing. It is explained there in detail how to do it.

Upvotes: 4

Related Questions