public static function createMainSearchFiltersCache() { // $mainSearchFilters['media']['formats'] = $this->getDistinctFieldAndCount('format', ['unit']); // $mainSearchFilters['media']['domains'] = $this->getDistinctFieldAndCount('domain', ['unit']); $mainSearchFilters['media']['categories'] = static::getCategories(); $mainSearchFilters['media']['all'] = ["count" => \MongoDB\Entity::whereIn('tags', ['unit'])->count(), "label" => "All Media"]; //unset($mainSearchFilters['media']['documentTypes']['twrex']); $mainSearchFilters['job']['count'] = Entity::where('documentType', 'job')->count(); $mainSearchFilters['workers']['count'] = \MongoDB\CrowdAgent::all()->count(); ksort($mainSearchFilters['media']['categories']); $entity = new \MongoDB\Temp(); $entity->_id = "mainSearchFilters"; $entity->filters = $mainSearchFilters; $entity->save(); return $entity->toArray(); }