public function init()
{
parent::init();
// If kind is not specified, figure out join type
if (!isset($this->kind)) {
$this->kind = $this->weak ? 'left' : 'inner';
}
// Add necessary hooks
if ($this->reverse) {
$this->owner->addHook('afterInsert', $this, null, -5);
$this->owner->addHook('beforeUpdate', $this, null, -5);
$this->owner->addHook('beforeDelete', [$this, 'doDelete'], null, -5);
} else {
$this->owner->addHook('beforeInsert', $this);
$this->owner->addHook('beforeUpdate', $this);
$this->owner->addHook('afterDelete', [$this, 'doDelete']);
$this->owner->addHook('afterLoad', $this);
}
}