protected function getWhereAsArray()
    {
        $filters = [];

        if (!empty($this->filters)) {
            $filters = $this->filters;
        }

        if (!$this->allowDeleted) {
            $filters[] = "(`" . $this->table . "`.deleted = 0 OR `" . $this->table . "`.deleted IS NULL)";
        }

        if (!empty($this->joins)) {
            foreach ($this->joins as $join) {
                $manager = $join['manager'];
                $filters = array_merge($filters, $manager->getWhereAsArray());
            }
        }

        return $filters;
    }