-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathapp.php
62 lines (52 loc) · 1.94 KB
/
app.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
require_once __DIR__.'/../vendor/autoload.php';
use GuzzleHttp\Client;
use Islandora\Chullo\FedoraApi;
use Islandora\Crayfish\Commons\EntityMapper\EntityMapper;
use Islandora\Crayfish\Commons\Provider\IslandoraServiceProvider;
use Islandora\Crayfish\Commons\Provider\YamlConfigServiceProvider;
use Islandora\Milliner\Controller\MillinerController;
use Islandora\Milliner\Service\MillinerService;
use Pimple\Exception\UnknownIdentifierException;
use Silex\Application;
$app = new Application();
$app->register(new IslandoraServiceProvider());
$app->register(new YamlConfigServiceProvider(__DIR__ . '/../cfg/config.yaml'));
$app['debug'] = $app['crayfish.debug'];
$app['milliner.controller'] = function () use ($app) {
try {
$strip_format_jsonld = filter_var(
$app['crayfish.strip_format_jsonld'],
FILTER_VALIDATE_BOOLEAN
);
} catch (UnknownIdentifierException $e) {
$strip_format_jsonld = false;
}
try {
$fedora6 = filter_var(
$app['crayfish.fedora6'],
FILTER_VALIDATE_BOOLEAN
);
} catch (UnknownIdentifierException $e) {
$fedora6 = false;
}
return new MillinerController(
new MillinerService(
FedoraApi::create($app['crayfish.fedora_base_url']),
new Client(),
new EntityMapper(),
$app['monolog'],
$app['crayfish.modified_date_predicate'],
$strip_format_jsonld,
$fedora6
),
$app['monolog']
);
};
$app->post('/node/{uuid}', "milliner.controller:saveNode");
$app->delete('/node/{uuid}', "milliner.controller:deleteNode");
$app->post('/node/{uuid}/version', "milliner.controller:createNodeVersion");
$app->post('/media/{source_field}', "milliner.controller:saveMedia");
$app->post('/media/{source_field}/version', 'milliner.controller:createMediaVersion');
$app->post('/external/{uuid}', "milliner.controller:saveExternal");
return $app;