Take a look at this tutorial / example. http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.htmlnote how the acrsas has changed. It looks like you may have cake 1.3 syntex.
- "The cold winds are rising" On Oct 13, 2012 6:46 PM, "CCorreia" <[email protected]> wrote: > Hello. I've just joined a project that is currently using cake as it's > framework, and one of the tasks assigned to me was to migrate the existing > 2.0 version of cake to the latest (now 2.2.3). > > Now a situation came up when moving from my windows localhost to the > server. It starts to fail right at the login. While debugging I did find > out that it's losing "something" along the way, I'll try to explain better. > > This is where the call > originates: $this->User->contain(array('UserInRole'=>array('Role'))); > > This are the 3 models: > > class User extends AppModel { > var $name = 'User'; > var $primaryKey = 'UserID'; > public $actsAs = array( 'Containable' ); > public $hasMany = array( > 'UserInRole' => array( > 'className' => 'UserInRole', > 'foreignKey' => 'UserID', > 'dependent' => false > ) > ); > ............... > > class UserInRole extends AppModel { > var $name = 'UserInRole'; > var $primaryKey = array( 'UserID','RoleID'); > public $actsAs = array( 'Containable' ); > public $belongsTo = array( > 'Role' => array( > 'className' => 'Role', > 'foreignKey' => 'RoleID', > 'dependent' => false > ), > 'User' => array( > 'className' => 'User', > 'foreignKey' => 'UserID', > 'dependent' => false > ) > ); > } > > class Role extends AppModel { > var $name = 'Role'; > var $primaryKey = 'RoleID'; > var $hasMany = array( > 'UserInRole' => array( > 'className' => 'UserInRole', > 'foreignKey' => 'RoleID', > 'counterCache' => true, > 'dependent' =>true > ) > ); > } > > > This is the error when running on linux: > > *Error: * SQLSTATE[42000]: Syntax error or access violation: 1064 You > have an error in your SQL syntax; check the manual that corresponds to your > MySQL server version for the right syntax to use near 'contain' at line 1 > > *SQL Query: * contain > > For this error if I debug I see that it's trying to execute a ' contain' > query. > > But on windows the same executes with the following query: "SHOW FULL > COLUMNS FROM `pmgcms2_cms`.`cms_users`" > > > I've been going at this for ages, but I haven't had any luck so far, so I > was hoping there's someone that might have ever had the same issue and can > give me some sort of clue. I'm lost right now. > > > Thanks > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en.
