Hey all -
I see a lot of questions about this, but nothing I've found references
the error I'm seeing so I thought I'd post here and see whether anyone
else recognizes what I'm doing wrong.
I have an Event model that habtm Attraction:
class Event extends AppModel {
public $name = 'Event';
public $belongsTo = 'Location';
public $hasAndBelongsToMany = 'Attraction';
...
}
class Attraction extends AppModel {
public $name = 'Attraction';
public $hasAndBelongsToMany = array ( 'Event' );
...
}
In my EventsController, I have:
$attractions = $this->Event->Attraction->find ( 'list' ); // the value
is being set() later in the controller code
And in my view:
echo $form->input (
'Attraction', // I've also tried Attraction.Attraction per the docs
array (
'type' => 'select',
'empty' => true
)
);
When I try to save my Event ($this->Event->save ( $this->data ) ), I
get this error:
SQL Error: 1110: Column 'event_id' specified twice [CORE/cake/libs/
model/datasources/dbo_source.php, line 514]
Query: INSERT INTO `attractions_events`
(`event_id`,`attraction_id`,`event_id`) VALUES ('4975132e-b0fc-42ee-
a13f-9e633b196446','495f9db0-
b548-4ee2-94ff-4aebc0a80232','4975132e-7a60-498b-819f-9e633b196446')
Anyone have any thoughts? I read and re-read the docs, plus a few
habtm blog posts, but I'm not seeing whatever it is I'm doing wrong.
I'd appreciate it if someone could point me in the right direction.
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---