In /posts/add, I'm saving a new post as well as all associated tags
with it (posts habtm tags). In 1.2 Beta, it worked fined, but in 1.2
RC1, I get these warnings:
Warning (2): array_merge() [function.array-merge]: Argument #1 is not
an array [CORE/cake/basics.php, line 528]
Warning (2): array_merge() [function.array-merge]: Argument #2 is not
an array [CORE/cake/basics.php, line 528]
Warning (2): Invalid argument supplied for foreach() [CORE/cake/
basics.php, line 534]
The post and tags still save, I just now get warnings. Here is my
code:
function add()
{
$this->pageTitle = 'Create Post';
if(!empty($this->data)) {
$this->Post->create();
$tags = explode(' ', trim($this->data['Tag']['name']));
foreach($tags as $tag) {
$this->Post->Tag->create(array('name' => $tag));
$current_tag = $this->Tag->findByName($tag);
if(is_array($current_tag)) {
$this->data['Tag']['Tag'][] =
$current_tag['Tag']['id'];
} else {
$this->Post->Tag->save();
$this->data['Tag']['Tag'][] =
$this->Post->Tag->id;
}
}
$this->Post->save($this->data);
$this->Session->setFlash('Your post has been created.',
$layout =
'flash_success');
$this->redirect(array('action'=>'index'));
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---