/** * Get metadata value by key * * @param string $key * @param mixed $default * @return mixed */ public function get($key, $default) { $metadata = $this->cache->get($this->getCacheKey()); if ($metadata === null) { $metadata = $this->metadataModel->getAll($this->entityId); $this->cache->set($this->getCacheKey(), $metadata); } return isset($metadata[$key]) ? $metadata[$key] : $default; }
/** * Proxy method to get sortable columns * * @param int $project_id * @param string $role * @return array|mixed */ public function getAllByRole($project_id, $role) { $key = $this->cachePrefix . $project_id . $role; $columnRestrictions = $this->cache->get($key); if ($columnRestrictions === null) { $columnRestrictions = $this->columnRestrictionModel->getAllByRole($project_id, $role); $this->cache->set($key, $columnRestrictions); } return $columnRestrictions; }
/** * Proxy method to get sortable columns * * @param int $project_id * @param string $role * @return array|mixed */ public function getSortableColumns($project_id, $role) { $key = $this->cachePrefix . $project_id . $role; $columnIds = $this->cache->get($key); if ($columnIds === null) { $columnIds = $this->columnMoveRestrictionModel->getSortableColumns($project_id, $role); $this->cache->set($key, $columnIds); } return $columnIds; }