-
Notifications
You must be signed in to change notification settings - Fork 19
/
OpenApi.php
69 lines (55 loc) · 2.16 KB
/
OpenApi.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
63
64
65
66
67
68
69
<?php
/* This file is part of the Thelia package. */
/* Copyright (c) OpenStudio */
/* email : [email protected] */
/* web : http://www.thelia.net */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
namespace OpenApi;
use OpenApi\Compiler\ModelPass;
use OpenApi\Model\Api\BaseApiModel;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator;
use Thelia\Module\BaseModule;
class OpenApi extends BaseModule
{
/** @var string */
const DOMAIN_NAME = 'openapi';
const PICKUP_ADDRESS_SESSION_KEY = 'pickup_address';
const OPEN_API_ROUTE_REQUEST_KEY = 'is_open_api_route';
const OPEN_API_MODELS_PARAMETER_KEY = 'OPEN_API_MODELS';
/*
* You may now override BaseModuleInterface methods, such as:
* install, destroy, preActivation, postActivation, preDeactivation, postDeactivation
*
* Have fun !
*/
public static function getCompilers()
{
return [
new ModelPass(),
];
}
/**
* Defines how services are loaded in your modules.
*/
public static function configureServices(ServicesConfigurator $servicesConfigurator): void
{
$servicesConfigurator->load(self::getModuleCode().'\\', __DIR__)
->exclude([THELIA_MODULE_DIR.ucfirst(self::getModuleCode()).'/I18n/*'])
->autowire(true)
->autoconfigure(true);
}
public static function loadConfiguration(ContainerBuilder $containerBuilder): void
{
$containerBuilder->registerForAutoconfiguration(BaseApiModel::class)
->setPublic(true)
->setShared(false)
->setParent("open_api.base.model")
->addTag('open_api.model');
}
public static function getAnnotationRoutePrefix(): string
{
return 'open_api';
}
}