Hi,

I have two tables, franchises and owners.

The owners table has a foreign key to franchises called franchise_id.

I've defined a $hasMany relationship between franchise and owners (ie.
1 franchise can have many owners).

I've defined a $belongsTo relationship between owner and franchise
(ie. an owner belongs to a franchise).

Now, I'm trying to edit franchise and the associated owner
information.  However, I can't seem to access the owner information.

Here is my franchises_controller.php function for edit:

        function edit($id = null)
        {
                if(empty($this->data['Franchise']))
                {
                        $this->Franchise->id = $id;
                        $this->data = $this->Franchise->read();
                }
                else
                {
                        if($this->Franchise->save($this->data['Franchise']))
                        {
                                $this->flash('Your franchise has been 
updated.', '/franchises/');
                        }
                }
        }

Here is my edit.thtml file.  Please note that I am confused as to how
the data is pre-populated in the form and why can't I seem to get the
owner associated data pre-populated?  I'm also trying to print the
$data array, with no success.

<h1>Edit Franchise</h1>

<form action="<?php echo $html->url('/franchises/edit') ?>"
method="post">
<?php echo $html->hidden('Franchise/id'); ?>

<p>Name: <?php echo $html->input('Franchise/name', array('size' =>
'40')) ?></p>
<p>Owner First Name: <?php echo $html->input('Owner/first_name',
array('size' => '40')) ?></p>

<?php echo print_r($data); ?>

<p><?php echo $html->submit('Save') ?></p>

</form>

Any help would be appreciated.

Thanks,

Jamie


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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