protected function joinClosureBy($column, $withSelf = false)
    {
        $primary = $this->getQualifiedKeyName();
        $closure = $this->closure->getTable();
        $ancestor = $this->closure->getQualifiedAncestorColumn();
        $descendant = $this->closure->getQualifiedDescendantColumn();

        switch ($column) {
            case 'ancestor':
                $query = $this->join($closure, $ancestor, '=', $primary)
                    ->where($descendant, '=', $this->getKey());
                break;

            case 'descendant':
                $query = $this->join($closure, $descendant, '=', $primary)
                    ->where($ancestor, '=', $this->getKey());
                break;
        }

        $depthOperator = ($withSelf === true ? '>=' : '>');

        $query->where($this->closure->getQualifiedDepthColumn(), $depthOperator, 0);

        return $query;
    }