Chapter 4 - hasAndBelongsToMany

7 messages Options
Embed this post
Permalink
Richard

Chapter 4 - hasAndBelongsToMany

Reply Threaded More More options
Print post
Permalink
Hi,
I'm using version cakePHP 1.2.4.8248
Only on Chapter 4 so far, but weird things happening when I try to add the 'has and belongs to many' relationship near the end of the chapter.

On the 'new post' screen I'm not getting any tags appearing, and on the 'new tag' screen I"m not getting any posts appearing. Finally when I add a new record on either of the posts, tags or users - I'm only getting the cake sql log without any of the surrounding HTML that indicates the record has been saved etc.

It looks like adding: var $hasAndBelongsToMany = array('Tag'); to post.php is causing the final problem because removing this line makes the save function as normal again.

I get the same problems with the downloadable source code.

Any advice appreciated.
Richard

Re: Chapter 4 - hasAndBelongsToMany

Reply Threaded More More options
Print post
Permalink
This has something to do with version 1.2.4 (8284) - I downloaded an old version of 1.2.3 and it functioned as laid out in the book.
mick

Re: Chapter 4 - hasAndBelongsToMany

Reply Threaded More More options
Print post
Permalink
i have the same problem. Any idea?
Pat

Re: Chapter 4 - hasAndBelongsToMany

Reply Threaded More More options
Print post
Permalink
In reply to this post by Richard
Hello,
I have the same problem with 1.3
Where can I get a copy of 1.2.3?
I cannot see it on cakephp
Thanks,
Pat.
nicholasf

Re: Chapter 4 - hasAndBelongsToMany

Reply Threaded More More options
Print post
Permalink
I'm using version 1.2.4.8284 and I too do NOT see the extra tag field when entering a new post nor the posts when entering a new tag.

I've checked and double checked to see if I went wrong somewhere but have failed to determine the issue.

Has anyone actually figured this out at all?

Any assistance is greatly appreciated as I don't want to actually move forward without first figuring out what is going on.
nicholasf

Re: Chapter 4 - hasAndBelongsToMany - FIXED

Reply Threaded More More options
Print post
Permalink
Well people, turns out this is a bug in CakePHP (still exists in 1.2.4.8284 as of the writing of this post).

The bug was reported here:

http://code.cakephp.org/tickets/view/48

The code patch is found here (for 1.2 - probably good for 1.3dev as well):

http://code.cakephp.org/commits/view/2c9fd2a4c963f1fd0030bfbe596b58d32c393ed8#highlight

Made the changes and all is well.
Derrick

Re: Chapter 4 - hasAndBelongsToMany - FIXED

Reply Threaded More More options
Print post
Permalink
This bug is fixed in 1.2.5.

http://code.cakephp.org/wiki/changelog/1_2_5