protected function addRelation()
{
if ($this->relationType == 'hasAndBelongsToMany') {
$junction = $this->getJunction();
try {
Validate::table($junction)->exists();
} catch (LazerException $e) {
Database::create($junction, array($this->tables['local'] . '_id' => 'integer', $this->tables['foreign'] . '_id' => 'integer'));
$this->insertRelationData($junction, $this->tables['local'], 'hasMany', array('local' => $this->tables['local'] . '_id', 'foreign' => $this->keys['local']));
$this->insertRelationData($junction, $this->tables['foreign'], 'hasMany', array('local' => $this->tables['foreign'] . '_id', 'foreign' => $this->keys['foreign']));
}
}
$this->insertRelationData($this->tables['local'], $this->tables['foreign'], $this->relationType, $this->keys);
}