Hi.
There are a number of ways to skin this cat. I have created a simplified example based loosely on what I can gather from your question.
Firstly, here is the YAML that I use to generate for my one-to-one model classes:
Identity:
columns:
username: string(50)
password: string(50)
email: string(50)
Profile:
columns:
identity_id: integer(10)
firstname: string(50)
lastname: string(50)
relations:
Identity:
foreignType: one
Now in PHP I can create a new Identity (or User in your case) and add related Profile data by simply:
$identity = new Identity();
$identity->username = 'james';
$identity->password = 'secret';
$identity->email = '[email protected]';
//now adding the related data
$identity->Profile->firstname = 'james';
$identity->Profile->lastname = 'bond';
$identity->save();
Hopefully this example will help you a bit.
edit:
here are the generated classes from the YAML in case that also helps:
BaseIdentity.php
<?php
abstract class BaseIdentity extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('identity');
$this->hasColumn('username', 'string', 50, array(
'type' => 'string',
'length' => '50',
));
$this->hasColumn('password', 'string', 50, array(
'type' => 'string',
'length' => '50',
));
$this->hasColumn('email', 'string', 50, array(
'type' => 'string',
'length' => '50',
));
}
public function setUp()
{
parent::setUp();
$this->hasOne('Profile', array(
'local' => 'id',
'foreign' => 'identity_id'));
}
}
BaseProfile.php
<?php
abstract class BaseProfile extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('profile');
$this->hasColumn('identity_id', 'integer', 10, array(
'type' => 'integer',
'length' => '10',
));
$this->hasColumn('firstname', 'string', 50, array(
'type' => 'string',
'length' => '50',
));
$this->hasColumn('lastname', 'string', 50, array(
'type' => 'string',
'length' => '50',
));
}
public function setUp()
{
parent::setUp();
$this->hasOne('Identity', array(
'local' => 'identity_id',
'foreign' => 'id'));
}
}