My One to One is not saving all the records on a table

if someone can delete this, i figured it out. it seems i needed a

$this->Visit->Coordinate->create();

Why it didnt need the create for the first part, Im not sure.


I have a one to one relationship. I add to a Visit table, then I want my Coordinate table to follow suit. If i add 10 visits, then my coordinates table should have 10 visits.

My visits are all added, but only the last coordinate record is added.

Where am I going wrong?

Thanks for any help.

TABLES

describe web_visits;
±----------±---------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±----------±---------±-----±----±--------±---------------+
| visitID | int(10) | NO | PRI | NULL | auto_increment |
| visitName | longtext | NO | | NULL | |
| visitDate | date | YES | | NULL | |
| visitMoon | text | NO | | NULL | |
±----------±---------±-----±----±--------±---------------+

describe web_coordinates;
±---------±-----------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±---------±-----------------±-----±----±--------±---------------+
| id | int(10) | NO | PRI | NULL | auto_increment |
| x_offset | float | NO | | NULL | |
| y_offset | float | NO | | NULL | |
| visitID | int(10) unsigned | YES | | NULL | |
±---------±-----------------±-----±----±--------±---------------+

MODELS

class Visit extends AppModel
{
    var $useTable = 'visits';
    var $useDbConfig = 'default';
	public $primaryKey = 'visitID';
	
	public $hasOne = array(
        'Coordinate' => array(
            'className' => 'Coordinate',
			'className' => 'Coordinate',
            'foreignKey' => 'visitID',
			'dependent' => true
        )
    );
}
class Coordinate extends AppModel
{
    var $useTable = 'coordinates';
    var $useDbConfig = 'default';	
	public $belongsTo = array(
        'Visit' => array(
            'className' => 'Visit',
            'foreignKey' => 'visitID'
        )
    );
}

CONTROLLER

(assume the variables are all correct)

foreach ($visits as $visit){
    $data = array('Visit'=>array(), 'Coordinate'=>array());
    
    $data['Visit'] = array(
                'visitID' => $visit ['visitID'],
                'visitName' => $visit ['TargetName'],
                'visitDate' => $visitDate,
                'visitMoon' => $moon);
    $visitRecord = $this->Visit->save($data);
    
    $data['Coordinate'] = array(
                'x_offset' => 0,
                'y_offset' => 0,
                'visitID'=>$this->Visit->id);
    
    $this->Visit->Coordinate->save($data);
}

I was following the doc on here, but I’m not sure whereI’m doing wrong? http://book.cakephp.org/2.0/en/models/saving-your-data.html

I appreciate any help.