Sure. This is from the NewsMessage side of things
var $hasAndBelongsToMany = array(
'NewsSubscriber' => array(
'className' => 'News.NewsSubscriber',
'joinTable' => 'news_messages_news_subscribers',
'with' => 'News.NewsMessagesNewsSubscriber',
'foreignKey' => 'news_message_id',
'associationForeignKey' => 'news_subscriber_id',
'conditions' => '',
'order' => '',
'limit' => '',
'unique' => true,
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);
I have tried removing the "News." prefix.
I have tried putting the join model in the "root" application.
(just to make see if anything happened)
/Martin
On Jan 14, 10:57 pm, Webweave <[email protected]> wrote:
> Can you post your HABTM from your models ?
>
> It looks like you have the model file in the right place, so my guess
> is that the problem is in there.
>
> On Jan 14, 4:59 am, Martin Westin <[email protected]> wrote:
>
> > Hi everyone,
>
> > This is the first time I have tried to make a real model for a joining
> > table and I got really stuck on this seemingly simple thing. I just
> > cant get it to work. Does anyone know how this file should be named?
>
> > I have a HABTM association between two models in a plugin. I have now
> > created a joining model to be able to capture some callbacks and write
> > custom "behaviours". Problem is Cake does not load the model but
> > resorts to creating its magic "empty" model based on AppModel. It does
> > not even seem to find the model's file.
>
> > The facts:
>
> > News.NewsMessage habtm News.NewsSubscriber
>
> > --- among other things in NewsMessage
> > 'with' => 'News.NewsMessagesNewsSubscriber',
> > ---
>
> > --- NewsMessagesNewsSubscriber
> > debug('NewsMessagesNewsSubscriber file was loaded');
> > class NewsMessagesNewsSubscriber extends NewsAppModel {
> > var $name = 'NewsMessagesNewsSubscriber';
> > function afterFind() {
> > debug('NewsMessagesNewsSubscriber class was used in a find');
> > }}
>
> > ---
>
> > I have but debug lines straight into the model file to see if it loads
> > at all and nothing. So I guess I have to name it something special I
> > can't figure out.
>
> > I have tried the following files placed in app/plugins/news/models/
> > news_messages_news_subscriber.php <-- should be this one, right?
> > news_message_news_subscriber.php
> > news_messages_news_subscribers.php
>
> > If you know what I should call this file, please reply while I have a
> > few hairs left on my head ;)
> > thanks
>
> > Martin Westin
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---