Well, after a lot of echo's in model.php I finally found out that the
problem was the most annoying simple crap possible.
CakePHP 1.2 is a bit more picky about how you define associations.
This is BAD:
var $hasAndBelongsToMany = array('Module');
This is GOOD:
var $hasAndBelongsToMany = array(
'Module' =>
array('className' => 'Module',
'conditions' => '',
'order' => '',
'limit' => '',
'uniq' => true,
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);
And, no. It does not really matter which of these properties or how
many you define. The important thing it that you define the Array KEY
as "Module".
Since finding works using the old and simple syntax you may also argue
that this is a bug or enhancement needed in save().
... around line 1231 ...
if (isset($this->hasAndBelongsToMany[$n]) || in_array($n,$this-
>hasAndBelongsToMany)) {
if (isset($v[$n])) {
$v = $v[$n];
$joined[$n] = $v;
}
} else {
...
The first line has been altered to include an additional condition.
With that or the more complex syntax I am all good and the HABTM saves
just as expected.
On Feb 18, 4:46 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Thanks but I don't think that was it. I altered my model.php but my
> problem remains.
>
> I do not even get any SQL queries that save anything. Not even buggy
> data.
>
> I am starting to think that it somewhere decides that the model hasn't
> changed and doesn't bother saving. (I am running $this->read() )
>
> On Feb 18, 2:56 pm, jakecake <[EMAIL PROTECTED]> wrote:
>
> > You are probably victim of this bug
> > :http://groups.google.com/group/cake-php/browse_thread/thread/2ad48c4e...
>
> > There are many threads here about problems with HABTM due to this bug.
>
> > I cannot understand why the cake home page still propose to download a
> > beta version containing this stupid error in a so important model.php.
> > Even the nightly contains this stupid bug, since almost 1 month. How
> > do we want to motivate people to learn Cake, if they spend hours and
> > hours to understand and solve a problem that is not a problem in their
> > code?
>
> > I don't understand...
>
> > JakeCake
>
> > ------------------
> > in model.php
>
> > if (isset($v[$n])) {
> > $v = $v[$n];
> > }
> > $joined[$n] = $v;
>
> > But it should say:
>
> > if (isset($v[$n])) {
> > $v = $v[$n];
> > $joined[$n] = $v;
> > }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---