Ok I've been searching trying to figure out my problem all day, with
no luck...

I have a table `channels` and a table `users`

Layout of `channels`:
id::int(11) PRIMARY KEY
title::varchar(255)
manager_id::int(11)
owner_id::int(11)

Layout of `users`:
id::int(11) PRIMARY KEY
name::varchar(100)

Name of Relationship (Manager):
`channels`.`manager_id` belongsTo `users`
`users` hasMany `channels`.`manager_id`

Name of Relationship (Owner):
`channels`.`owner_id` belongsTo `users`
`users` hasMany `channels`.`owner_id`

My edit form:
<?php
        echo $form->input('id');
        echo $form->input('title');
        echo $form->input('Manager');
        echo $form->input('Owner');
?>

My edit function in ChannelsController:
function edit($id = null) {
        if (!$id && empty($this->data)) {
                $this->Session->setFlash(__('Invalid Channel', true));
                $this->redirect(array('action'=>'index'));
        }
        if (!empty($this->data)) {
                if ($this->Channel->save($this->data)) {
                        $this->Session->setFlash(__('The Channel has been 
saved', true));
                        $this->redirect(array('action'=>'index'));
                } else {
                        $this->Session->setFlash(__('The Channel could not be 
saved.
Please, try again.', true));
                }
        }
        if (empty($this->data)) {
                $this->data = $this->Channel->read(null, $id);
        }
        $tags = $this->Channel->Tag->find('list');
        $manager = $this->Channel->Manager->find('list');
        $owner = $this->Channel->Owner->find('list');
        $this->set(compact('tags', 'manager', 'owner'));
}

The id's for manager and owner are being set into $this->data, but
they are not being saved in the database. The resulting entry in the
db is an id of 0 for both fields. Why is this not saving?
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to