Re: Data Formatting Errors

2009-08-19 Thread Andy

Great! Thanks for that. The stuff in the article helped with the
saving of the Categories, which had already been created in the
database.

However, in the case of the Tags, most of the records in the array did
not exist in the database. It was not working with either the saveAll
() function or associating the Post ID with the tags and then saving.
What I did was go through the Tags individually and save them before
saving the Post, to which I just passed the array of Tag IDs. Is there
a better way to do this?

Thanks again!

On Aug 19, 3:15 am, majna  wrote:
> http://groups.google.com/group/cake-php/browse_thread/thread/4f462c16...
>
> On Aug 18, 5:10 pm, Andy  wrote:
>
>
>
> > Greetings, all,
> >      I'm working on a CMS based on CakePHP and I've been enjoying
> > working with Cake so far. However, I'm having some issues saving
> > information. My CMS has a normal post-oriented setup in which each
> > post can be related to multiple tags and multiple categories. I've set
> > up the associations correctly in the models and the views generated by
> > Bake seem to work fine.
>
> > However, I'm using a custom client and building my array inside the
> > client. The client has the capability of adding new tags to each post,
> > then saving the tags at the same time as the post. However, when I try
> > to save all the data, it fails to save either the categories or the
> > tags.
>
> > Here's an example of the array that the client generates:
>
> >     [Post] => Array
> >         (
> >             [user_id] => 11
> >             [posted] => 2009-08-18 10:20:00
> >             [title] => This is a Great Post!
> >             [comments_allowed] => 1
> >             [media_id] => 1
> >             [slug] => this-is-a-great-post
> >             [seo_title] => SEO rocks.
> >             [status] => 1
> >             [created] => 2009-08-18 10:25:53
> >             [id] => 2
> >             [content] => whatever
> >         )
>
> >     [Category] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [id] => 1
> >                     [name] => Latest News
> >                     [slug] => news
> >                 )
>
> >             [1] => Array
> >                 (
> >                     [id] => 3
> >                     [name] => Stuff
> >                     [slug] => stuff
> >                 )
>
> >         )
>
> >     [Tag] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [id] => 3
> >                     [name] => college
> >                     [slug] => college
> >                 )
>
> >             [1] => Array
> >                 (
> >                     [name] => snap
> >                     [slug] => snap
> >                 )
>
> >             [2] => Array
> >                 (
> >                     [name] => fish
> >                     [slug] => fish
> >                 )
>
> >         )
>
> > Right now I'm passing this into Cake and doing a saveAll() call. It
> > saves the post correctly, but erases all related tags and categories.
> > Would you all have any comments or suggestions on what I need to do to
> > get this working correctly? Thanks for your time!
>
> > ~Andy
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Data Formatting Errors

2009-08-19 Thread majna

http://groups.google.com/group/cake-php/browse_thread/thread/4f462c16187e9c99/96cc07bb376797b2?tvc=2#96cc07bb376797b2

On Aug 18, 5:10 pm, Andy  wrote:
> Greetings, all,
>      I'm working on a CMS based on CakePHP and I've been enjoying
> working with Cake so far. However, I'm having some issues saving
> information. My CMS has a normal post-oriented setup in which each
> post can be related to multiple tags and multiple categories. I've set
> up the associations correctly in the models and the views generated by
> Bake seem to work fine.
>
> However, I'm using a custom client and building my array inside the
> client. The client has the capability of adding new tags to each post,
> then saving the tags at the same time as the post. However, when I try
> to save all the data, it fails to save either the categories or the
> tags.
>
> Here's an example of the array that the client generates:
>
>     [Post] => Array
>         (
>             [user_id] => 11
>             [posted] => 2009-08-18 10:20:00
>             [title] => This is a Great Post!
>             [comments_allowed] => 1
>             [media_id] => 1
>             [slug] => this-is-a-great-post
>             [seo_title] => SEO rocks.
>             [status] => 1
>             [created] => 2009-08-18 10:25:53
>             [id] => 2
>             [content] => whatever
>         )
>
>     [Category] => Array
>         (
>             [0] => Array
>                 (
>                     [id] => 1
>                     [name] => Latest News
>                     [slug] => news
>                 )
>
>             [1] => Array
>                 (
>                     [id] => 3
>                     [name] => Stuff
>                     [slug] => stuff
>                 )
>
>         )
>
>     [Tag] => Array
>         (
>             [0] => Array
>                 (
>                     [id] => 3
>                     [name] => college
>                     [slug] => college
>                 )
>
>             [1] => Array
>                 (
>                     [name] => snap
>                     [slug] => snap
>                 )
>
>             [2] => Array
>                 (
>                     [name] => fish
>                     [slug] => fish
>                 )
>
>         )
>
> Right now I'm passing this into Cake and doing a saveAll() call. It
> saves the post correctly, but erases all related tags and categories.
> Would you all have any comments or suggestions on what I need to do to
> get this working correctly? Thanks for your time!
>
> ~Andy
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Data Formatting Errors

2009-08-18 Thread Andy

Greetings, all,
 I'm working on a CMS based on CakePHP and I've been enjoying
working with Cake so far. However, I'm having some issues saving
information. My CMS has a normal post-oriented setup in which each
post can be related to multiple tags and multiple categories. I've set
up the associations correctly in the models and the views generated by
Bake seem to work fine.

However, I'm using a custom client and building my array inside the
client. The client has the capability of adding new tags to each post,
then saving the tags at the same time as the post. However, when I try
to save all the data, it fails to save either the categories or the
tags.

Here's an example of the array that the client generates:

[Post] => Array
(
[user_id] => 11
[posted] => 2009-08-18 10:20:00
[title] => This is a Great Post!
[comments_allowed] => 1
[media_id] => 1
[slug] => this-is-a-great-post
[seo_title] => SEO rocks.
[status] => 1
[created] => 2009-08-18 10:25:53
[id] => 2
[content] => whatever
)

[Category] => Array
(
[0] => Array
(
[id] => 1
[name] => Latest News
[slug] => news
)

[1] => Array
(
[id] => 3
[name] => Stuff
[slug] => stuff
)

)

[Tag] => Array
(
[0] => Array
(
[id] => 3
[name] => college
[slug] => college
)

[1] => Array
(
[name] => snap
[slug] => snap
)

[2] => Array
(
[name] => fish
[slug] => fish
)

)

Right now I'm passing this into Cake and doing a saveAll() call. It
saves the post correctly, but erases all related tags and categories.
Would you all have any comments or suggestions on what I need to do to
get this working correctly? Thanks for your time!

~Andy

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---