remembered your post from a few days ago. Did you figure anything out?
My situation is that I have a Post model with an optional associated
Poll. I use $this->Post->saveAll() in the controller and, when I
checked the DB I saw this same corruption in my title & body fields.
mysql> select * from polls\G
*************************** 1. row ***************************
id: 1
created: 2010-02-28 15:10:39
modified: 2010-02-28 15:10:39
post_id: 0
active: 0
visible: 0
title: 2est
body: 2p>some other text</p>
1 row in set (0.00 sec)
The post_id did not get set, also.
In your case, the U suggested that this was related to the model name,
User. But this 2 is something else.
I changed the logic to use save() for my Post, then set $this-
>data['Poll']['post_id'] and used saveAll() for Poll (there are
associated PollChoices). The content looks fine.
I'm using 1.2.5. The Poll model has no behaviors.
On Feb 25, 1:32 pm, Andrew <and...@websitesthatdostuff.com> wrote:
> I'm working on retrieving a stack of data and for some reason some of
> the data gets corrupted. For instance, I've got some Post models that
> each are related to Comment models (hasMany), and each of the Comment
> models belongsTo a User. When retrieving the data, here's what I get
> from the database for the comments:
>
> [Post] => Array
> (
> )
>
> [Comments] => Array
> (
> [0] => Array
> (
> [content] => 2010 has definitely been a busy year!
> [created] => 2010-02-10 13:47:15
> [user_id] => 18
> [post_id] => 1
> [User] => Array
> (
> [id] => U8
> [username] => Uace
> [first_name] => Uace
> )
>
> [_explicitType] => Comment
> )
>
> [0] => Array
> (
> [content] => I can't wait...
> [created] => 2009-12-10 13:57:36
> [user_id] => 18
> [post_id] => 1
> [User] => Array
> (
> [id] => U8
> [username] => Uace
> [first_name] => Uace
> )
>
> [_explicitType] => Comment
> )
>
> )
>
> The first character of each of the Comments[i][User] arrays has been
> replaced with a capital U, though in each case it should be different
> (such as ID of 18, username of Jace, etc).
>
> I've checked the character encoding and found no issues. I have it set
> to UTF-8 in core.php, in database.php, and in the database itself. Any
> suggestions?
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment