public $person_id;
public $person_table;
+
+ public $invite_id;
+ public $friend_table;
function convertTo($target = false)
{
}
$roo = HTML_FlexyFramework::get()->page;
-
+ $old = clone($this);
// this shold not really happen...
if($target->get('email', $this->email)){
+ $this->person_id = $target->id;
+ $this->person_table = $target->tableName();
+ $this->update($old);
+
return $target;
}
$this->person_id = $target->id;
$this->person_table = $target->tableName();
- $this->update();
- // ok - deleting might not be a great idea.... - as we can not track already confirmed codes..
+ $this->update($old);
- //$this->delete();
+ if(!empty($this->invite_id) && !empty($this->friend_table)){
+ $friend = DB_DataObject::factory($this->friend_table);
+ $friend->setFrom(array(
+ 'person_id' => $this->invite_id,
+ 'friend_id' => $target->id
+ ));
+
+ $friend->insert();
+ }
return $target;
}