public function testJoinSaving2()
{
$a = ['user' => ['_' => ['id' => 1, 'name' => 'John']], 'contact' => ['_' => ['id' => 1, 'contact_phone' => '+123', 'test_id' => 0]]];
$db = new Persistence_SQL($this->db->connection);
$m_u = new Model($db, 'user');
$this->setDB($a);
$m_u->addField('name');
$j = $m_u->join('contact.test_id');
$j->addField('contact_phone');
$m_u['name'] = 'John';
$m_u['contact_phone'] = '+123';
$m_u->save();
$this->assertEquals(['user' => [1 => ['id' => 1, 'name' => 'John']], 'contact' => [1 => ['id' => 1, 'test_id' => 1, 'contact_phone' => '+123']]], $this->getDB('user,contact'));
$m_u->unload();
$m_u['name'] = 'Peter';
$m_u->save();
$this->assertEquals(['user' => [1 => ['id' => 1, 'name' => 'John'], 2 => ['id' => 2, 'name' => 'Peter']], 'contact' => [1 => ['id' => 1, 'test_id' => 1, 'contact_phone' => '+123'], 2 => ['id' => 2, 'test_id' => 2, 'contact_phone' => null]]], $this->getDB('user,contact'));
$this->db->connection->dsql()->table('contact')->where('id', 2)->delete();
$m_u->unload();
$m_u['name'] = 'Sue';
$m_u['contact_phone'] = '+444';
$m_u->save();
$this->assertEquals(['user' => [1 => ['id' => 1, 'name' => 'John'], 2 => ['id' => 2, 'name' => 'Peter'], 3 => ['id' => 3, 'name' => 'Sue']], 'contact' => [1 => ['id' => 1, 'test_id' => 1, 'contact_phone' => '+123'], 3 => ['id' => 3, 'test_id' => 3, 'contact_phone' => '+444']]], $this->getDB('user,contact'));
}