Thanks for your thoughts Adam.

I made a very simple function (below), the result seems to be that
even if there isn't a LensMount entry Cake still deletes the old HABTM
table record, and tries to recreate it. I think the only way I can do
this is to stop using the HABTM relationship and do it manually - in
this case it's not hard to do.

$j = $this->Lens->findById(1);
$j['Lens']['name'] = 'x' . $j['Lens']['name'];
$j['Lens'][0] = null;
$this->Lens->save($j['Lens']))

Other ideas are welcome

Thanks

Tim

On Feb 2, 12:01 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> I may be wrong in saying this, but I don't thinkcakeshould affect
> yourHABTMassociationsif there is no LensMount key in $this->data
> when you save.
>
> Try pr($this->data); before your save to see what keys are sent to the
> model.
>
> Adam
>
> On Feb 2, 6:55 am, Tim Wild <[EMAIL PROTECTED]> wrote:
>
> > Does anyone have an idea about this? Or do I stop usingHABTMand do it
> > with a plain old database call?
>
> > Tim W wrote:
> > > Hi all,
>
> > > I have aHABTMrelationship that's working, but I want to tell it not
> > > to delete and create new rows in the many to many table - Ionlywant
> > > it to treat that table asreadonly. Using the following unbindModel
> > > command doesn't seem to affect it.
>
> > > $this->Lens->unbindModel(array('hasAndBelongsToMany' =>
> > > array('LensMount')));
>
> > > (Just FYI the models are Lens and LensMount, with appropriate tables,
> > > and a lenses_lens_mounts table with no model)
>
> > > I've seen the links posted to "Working withHABTMassociations" and
> > > "HABTMAdd & Delete Behavior", but neither seem to address my problem.
> > > I figure there must be a simple way to disable theHABTMduring save.
>
> > > How do I tellCakenot to mess with the join table?
>
> > > Thanks
>
> > > Tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to