Re: legacy db with non standard foreignkey hasMany association

2013-08-07 Thread Simon Males
I've never done anything like this but you can tell the Campaign model what the primary key is using the $primaryKey attribute. http://book.cakephp.org/2.0/en/models/model-attributes.html#primarykey class Campaign extends AppModel { $primaryKey = 'code'; } On Wed, Aug 7, 2013 at 6:59 AM, NikNi

legacy db with non standard foreignkey hasMany association

2013-08-06 Thread NikNik
Hello, I must work on a pretty old database and I am forced to use a table ( Campaign ) that didn't have a numeric primary key . The former primary key was the field "code" varchar(6). So I had to add an autoincrement id field. Campaign hasMany Users in the Campaign model I then have: public