Wednesday, January 25, 2012

Controller routing to home page issue

Hi,

I'll try and explain this issue as succinctly as I can.

First off - I'm not a cakePHP novice but neither am I an expert. Our
company has inherited a couple of sites developed in cakePHP (one is
v1.1 and one is v1.3) so I get to delve into it about once every 3
months or so to apply an occasional change.

My problem is this (cakePHP v1.3):

I have 2 models 'person' and 'action'. A single person can have
multiple actions assigned to it. The current application only has an
admin function for the 'person' (controller,views etc.) as the
'actions' are administered by a different application. My requirement
is now to allow the application to manage the actions. To this end I
have created the controller and views - however, whenever I try to
access the relevant url for the actions, I am always redirected to the
admin homepage. e.g.

mydomain.com/admin/actions/add I would expect to call the admin_add()
method of the action controller but it just redirects to the homepage.

I have checked the config/routes.php and there is nothing there to
cause this.

My models are defined as follows:

class Person extends AppModel {
var $name = 'Person';
var $displayField = 'title';
var $reputation;
var $locked;
var $belongsTo = array ('User');

var $hasMany = array ('Action');
var $validate = array(

'title' => array(
'notempty' => array(
'rule' => array('notempty')
),
'location' => array(
'notempty' => array(
'rule' => array('notempty')
),
),
);
}

class Action extends AppModel {
var $name = 'Action';
var $displayField = 'title';
var $locked;

var $belongsTo = array(
'Person' => array(
'className' => 'Person',
'foreignKey' => 'person_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}

I'm at a loss as to where to look or go from here. I am not getting
any error message (debug is set to 2).

Any clues or ideas gratefully received.

PG

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: