public function testRoundTrip() { $model = new Relax_Client_Model($this->connection); $model->hasMany($model->define('Customer')->hasMany('Address', 'addresses')->hasMany('Transaction')); $model->customers()->create(array('name' => 'Lachlan'))->addresses()->create(array('street' => 'Oriel Rd')); $this->assertEquals($model->customers(1)->name, 'Lachlan'); $this->assertEquals($model->customers(1)->addresses(1)->street, 'Oriel Rd'); $model->customers(1)->set('name', 'Fred')->save(); $model->customers(1)->addresses(1)->set('street', 'Some St')->save(); $this->assertEquals($model->customers(1)->name, 'Fred'); $this->assertEquals($model->customers(1)->addresses(1)->street, 'Some St'); }