If you are solely using the 'id' attribute as your primary key in the
join table, then you are opening up the possibility of allowing a user
to be associated with the same event multiple times.
Yip, makes quite obvious sense
--~--~-~--~~~---~--~~
You received
First things first, your relationships are a bit mixed up ... both
models should HABTM each other, you're confusing things by trying to
create User hasMany Event. Remove users_id from events table, specify
that User HABTM Event and rely on the join table to relate things.
Not sure why mscdex
Okey, i have done that know.
Though im getting a SQL error that is shouldn't get:
Warning (512): SQL Error: 1054: Unknown column 'EventsUsers.user_id'
in 'where clause' [CORE\cake\libs\model\datasources\dbo_source.php,
line 514]
Query: SELECT `Event`.`id`, `Event`.`user_id`, `Event`.`title` FROM
It runs smooth.
Thought i tell you what i did:
==this is my event controlller
var $uses = array('User');
function show() {
$this-set('events', $this-User-find('all', array
('conditions'=array('id' = $this-Auth-user('id');
}
==Relations
User hasMany Event
User HABTM
Got your email, but will reply in here ... seems I got things slightly
wrong as I forgot that Cake only joins hasOne and belgonsTo
associations by default and as such you cant run a $this-Event-find
() call with a condition from the EventsUsers join table.
Simple way to get around this should be
On Feb 7, 5:11 am, WebbedIT p...@webbedit.co.uk wrote:
Not sure why mscdex advises removing the id field from the join table,
I include one in all my join tables without issue, but happy for
mscdex to elaborate and inform us of some performance improvement that
may cause :)
If you are solely
Hello!
Im been at this for hours and hanging in the IRC channel, without
getting the final solution.
I want to share events between users...
**I have these relations:
User hasmany Event
Event HABTM User
**I have these tables
[events]
-id
-user_id
-title
[users]
-id
-email
-and some other
in case you don't find the good way ti do it i suggest you to
create a custom model method using $this-query('your custom query')
On Feb 6, 7:57 pm, abergs.and...@gmail.com abergs.and...@gmail.com
wrote:
Hello!
Im been at this for hours and hanging in the IRC channel, without
getting
On Feb 6, 7:57 pm, abergs.and...@gmail.com abergs.and...@gmail.com
wrote:
Hello!
Im been at this for hours and hanging in the IRC channel, without
getting the final solution.
I want to share events between users...
**I have these relations:
User hasmany Event
Event HABTM User
**I have