ConceptSchemeController extends Controller uses AuthorizationContextTrait, CapabilityContextTrait, ModelCallTrait, PermissionAuthorizerTrait, PrepareFilter, PrepareSearch, PrepareSort
Exposes a hierarchical thesaurus as a SKOS {@see ConceptScheme} : its `hasTopConcept` is the set of **roots** (the concepts that have no broader parent), assembled on the fly from the underlying {@see Documents} model.
It is generic and read-only : a consumer wires one instance (a plain
GetRoute is enough — there is a single entry point), configured with the
thesaurus model (self::MODEL), a display title (self::TITLE), the
"broader" relation key whose absence marks a root (self::RELATION,
defaulting to Oihana::BROADER) and the skin used to project the roots
(self::SKIN, defaulting to Skin::FULL). It honours ?sort,
?search and ?filter on the roots — the model applies its own
SORTABLE/SEARCHABLE/AQL::FILTERS whitelist, and the request-scoped
authorizer gates Field::REQUIRES so a hidden attribute cannot be probed
through ?filter=. Nothing is persisted.
Like DocumentsController and PropertyController, it carries an
authorization seat: the model call is wrapped by the
ModelCallTrait hooks, so a consumer can impose a server-side scope the
caller cannot widen — ?filter= is the caller's lever, and it is folded in
before the hook runs. The class poses no scope of its own: a subclass
overriding beforeModelCall() appends its predicate to Arango::FILTER
(as one operand of an explicit and, never spliced) or its AQL fragments to
Arango::CONDITIONS — list() honours both.
The request-scoped authorizer is posed before the hook rather than by it,
so an override calling parent::beforeModelCall() reaches the trait's no-op :
harmless, and the authorizer is already there.
Tags
Table of Contents
Constants
- MODEL : string = 'model'
- Initialization key for the thesaurus model.
- RELATION : string = 'relation'
- Initialization key for the broader relation key (its absence marks a root).
- SKIN : string = 'skin'
- Initialization key for the skin used to project the root concepts.
- TITLE : string = 'title'
- Initialization key for the scheme display title.
Properties
- $model : Documents|null
- The thesaurus model whose roots become the scheme's top concepts.
- $relation : string
- The broader relation key (a concept with no such relation is a root).
- $skin : string
- The skin used to project the root concepts.
- $title : string
- The human-readable scheme name.
Methods
- __construct() : mixed
- Creates a new ConceptSchemeController instance.
- get() : mixed
- Returns the thesaurus as a {@see ConceptScheme} whose `hasTopConcept` is the list of root concepts (those with no broader relation).
- initializeAuthorizationContext() : static
- Resolves the capability enforcer and the permission-subject resolver from the container (each guarded by an `instanceof`, null when absent) and wires them through `initializeCapabilities()` and `initializePermissionSubjectResolver()`.
Constants
MODEL
Initialization key for the thesaurus model.
public
string
MODEL
= 'model'
RELATION
Initialization key for the broader relation key (its absence marks a root).
public
string
RELATION
= 'relation'
SKIN
Initialization key for the skin used to project the root concepts.
public
string
SKIN
= 'skin'
TITLE
Initialization key for the scheme display title.
public
string
TITLE
= 'title'
Properties
$model
The thesaurus model whose roots become the scheme's top concepts.
protected
Documents|null
$model
= null
$relation
The broader relation key (a concept with no such relation is a root).
protected
string
$relation
= \xyz\oihana\schema\constants\Oihana::BROADER
$skin
The skin used to project the root concepts.
protected
string
$skin
= \oihana\controllers\enums\Skin::FULL
$title
The human-readable scheme name.
protected
string
$title
= \oihana\enums\Char::EMPTY
Methods
__construct()
Creates a new ConceptSchemeController instance.
public
__construct(Container $container[, array<string|int, mixed> $init = [] ]) : mixed
Parameters
- $container : Container
-
The DI container reference.
- $init : array<string|int, mixed> = []
-
Supports:
- self::MODEL : the thesaurus
Documentsmodel (service id or instance), - self::TITLE : the human-readable scheme name,
- self::RELATION : the broader relation key (default Oihana::BROADER),
- self::SKIN : the skin used to project the roots (default
full).
- self::MODEL : the thesaurus
Tags
get()
Returns the thesaurus as a {@see ConceptScheme} whose `hasTopConcept` is the list of root concepts (those with no broader relation).
public
get([ServerRequestInterface|null $request = null ][, ResponseInterface|null $response = null ][, array<string|int, mixed> $args = [] ][, array<string|int, mixed> $init = [] ]) : mixed
Parameters
- $request : ServerRequestInterface|null = null
- $response : ResponseInterface|null = null
- $args : array<string|int, mixed> = []
- $init : array<string|int, mixed> = []
Tags
initializeAuthorizationContext()
Resolves the capability enforcer and the permission-subject resolver from the container (each guarded by an `instanceof`, null when absent) and wires them through `initializeCapabilities()` and `initializePermissionSubjectResolver()`.
protected
initializeAuthorizationContext([array<string, mixed> $init = [] ]) : static
Parameters
- $init : array<string, mixed> = []
-
Same array passed to the controller constructor.