ApkgController
extends VocabularyBaseController
in package
HTTP entry points for round-trip Anki .apkg interop:
GET /vocabulary/apkg/export?lang_id=N stream a .apkg download GET /vocabulary/apkg/import render the upload form POST /vocabulary/apkg/import accept upload + render summary
The orchestration lives in ApkgExportService / ApkgImportService; this controller is just request parsing + response shaping.
Table of Contents
Properties
- $bulkService : WordBulkService|null
- $contextService : WordContextService|null
- $crudService : WordCrudService|null
- Lazy-loaded services.
- $discoveryService : WordDiscoveryService|null
- $expressionService : ExpressionService|null
- $linkingService : WordLinkingService|null
- $multiWordService : MultiWordService|null
- $sentenceService : SentenceService|null
- $textStatisticsService : TextStatisticsService|null
- $uploadService : WordUploadService|null
- $viewPath : string
- View base path.
- $exportService : ApkgExportService|null
- $importService : ApkgImportService|null
- $languageFacade : LanguageFacade
Methods
- __construct() : mixed
- Constructor.
- export() : never
- Export terms as a .apkg, streamed to the browser.
- importForm() : void
- Render the import upload form (GET) or process the upload (POST).
- setViewPath() : void
- Set custom view path.
- getBulkService() : WordBulkService
- Get WordBulkService (lazy loaded).
- getContextService() : WordContextService
- Get WordContextService (lazy loaded).
- getCrudService() : WordCrudService
- Get WordCrudService (lazy loaded).
- getDiscoveryService() : WordDiscoveryService
- Get WordDiscoveryService (lazy loaded).
- getExpressionService() : ExpressionService
- Get ExpressionService (lazy loaded).
- getLinkingService() : WordLinkingService
- Get WordLinkingService (lazy loaded).
- getMultiWordService() : MultiWordService
- Get MultiWordService (lazy loaded).
- getSentenceService() : SentenceService
- Get SentenceService (lazy loaded).
- getTextStatisticsService() : TextStatisticsService
- Get TextStatisticsService (lazy loaded).
- getUploadService() : WordUploadService
- Get WordUploadService (lazy loaded).
- render() : void
- Render a view.
- exportSvc() : ApkgExportService
- handleImportSubmit() : void
- importSvc() : ApkgImportService
- renderImportForm() : void
- slugify() : string
- streamDownload() : never
Properties
$bulkService
protected
WordBulkService|null
$bulkService
= null
$contextService
protected
WordContextService|null
$contextService
= null
$crudService
Lazy-loaded services.
protected
WordCrudService|null
$crudService
= null
$discoveryService
protected
WordDiscoveryService|null
$discoveryService
= null
$expressionService
protected
ExpressionService|null
$expressionService
= null
$linkingService
protected
WordLinkingService|null
$linkingService
= null
$multiWordService
protected
MultiWordService|null
$multiWordService
= null
$sentenceService
protected
SentenceService|null
$sentenceService
= null
$textStatisticsService
protected
TextStatisticsService|null
$textStatisticsService
= null
$uploadService
protected
WordUploadService|null
$uploadService
= null
$viewPath
View base path.
protected
string
$viewPath
$exportService
private
ApkgExportService|null
$exportService
$importService
private
ApkgImportService|null
$importService
$languageFacade
private
LanguageFacade
$languageFacade
Methods
__construct()
Constructor.
public
__construct([LanguageFacade|null $languageFacade = null ][, ApkgExportService|null $exportService = null ][, ApkgImportService|null $importService = null ]) : mixed
Parameters
- $languageFacade : LanguageFacade|null = null
- $exportService : ApkgExportService|null = null
- $importService : ApkgImportService|null = null
export()
Export terms as a .apkg, streamed to the browser.
public
export(array<string, string> $params) : never
Accepted parameters (any source — query string for GET, body for POST):
- lang_id int target language; defaults to the current language
- marked[] int[] optional subset of WoIDs; empty/missing = whole language
Parameters
- $params : array<string, string>
-
Route params (unused).
Return values
neverimportForm()
Render the import upload form (GET) or process the upload (POST).
public
importForm(array<string, string> $params) : void
Parameters
- $params : array<string, string>
-
Route params (unused).
setViewPath()
Set custom view path.
public
setViewPath(string $path) : void
Parameters
- $path : string
-
View path
getBulkService()
Get WordBulkService (lazy loaded).
protected
getBulkService() : WordBulkService
Return values
WordBulkServicegetContextService()
Get WordContextService (lazy loaded).
protected
getContextService() : WordContextService
Return values
WordContextServicegetCrudService()
Get WordCrudService (lazy loaded).
protected
getCrudService() : WordCrudService
Return values
WordCrudServicegetDiscoveryService()
Get WordDiscoveryService (lazy loaded).
protected
getDiscoveryService() : WordDiscoveryService
Return values
WordDiscoveryServicegetExpressionService()
Get ExpressionService (lazy loaded).
protected
getExpressionService() : ExpressionService
Return values
ExpressionServicegetLinkingService()
Get WordLinkingService (lazy loaded).
protected
getLinkingService() : WordLinkingService
Return values
WordLinkingServicegetMultiWordService()
Get MultiWordService (lazy loaded).
protected
getMultiWordService() : MultiWordService
Return values
MultiWordServicegetSentenceService()
Get SentenceService (lazy loaded).
protected
getSentenceService() : SentenceService
Return values
SentenceServicegetTextStatisticsService()
Get TextStatisticsService (lazy loaded).
protected
getTextStatisticsService() : TextStatisticsService
Return values
TextStatisticsServicegetUploadService()
Get WordUploadService (lazy loaded).
protected
getUploadService() : WordUploadService
Return values
WordUploadServicerender()
Render a view.
protected
render(string $view[, array<string|int, mixed> $data = [] ]) : void
Parameters
- $view : string
-
View name (without .php)
- $data : array<string|int, mixed> = []
-
View data
exportSvc()
private
exportSvc() : ApkgExportService
Return values
ApkgExportServicehandleImportSubmit()
private
handleImportSubmit() : void
importSvc()
private
importSvc() : ApkgImportService
Return values
ApkgImportServicerenderImportForm()
private
renderImportForm(string|null $error, ImportResult|null $result) : void
Parameters
- $error : string|null
- $result : ImportResult|null
slugify()
private
slugify(string $name) : string
Parameters
- $name : string
Return values
stringstreamDownload()
private
streamDownload(string $path, string $filename) : never
Parameters
- $path : string
- $filename : string