1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace EventEspresso\core\domain\entities\routing\handlers\shared; |
4
|
|
|
|
5
|
|
|
use EE_Dependency_Map; |
6
|
|
|
use EventEspresso\core\domain\entities\routing\handlers\Route; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class RestApiRequests |
10
|
|
|
* registers dependencies and loads resources for REST API requests |
11
|
|
|
* |
12
|
|
|
* @package EventEspresso\core\domain\entities\routing\handlers\shared |
13
|
|
|
* @author Brent Christensen |
14
|
|
|
* @since \$VID:$ |
15
|
|
|
*/ |
16
|
|
|
class RestApiRequests extends Route |
17
|
|
|
{ |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* returns true if the current request matches this route |
21
|
|
|
* |
22
|
|
|
* @return bool |
23
|
|
|
* @since $VID:$ |
24
|
|
|
*/ |
25
|
|
|
public function matchesCurrentRequest() |
26
|
|
|
{ |
27
|
|
|
return $this->request->isWordPressApi(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @since $VID:$ |
33
|
|
|
*/ |
34
|
|
View Code Duplication |
protected function registerDependencies() |
35
|
|
|
{ |
36
|
|
|
$this->dependency_map->registerDependencies( |
37
|
|
|
'EventEspresso\core\libraries\rest_api\CalculatedModelFields', |
38
|
|
|
[ |
39
|
|
|
'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache |
40
|
|
|
] |
41
|
|
|
); |
42
|
|
|
$this->dependency_map->registerDependencies( |
43
|
|
|
'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory', |
44
|
|
|
['EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache] |
45
|
|
|
); |
46
|
|
|
$this->dependency_map->registerDependencies( |
47
|
|
|
'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
48
|
|
|
['EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache] |
49
|
|
|
); |
50
|
|
|
$this->dependency_map->registerDependencies( |
51
|
|
|
'EventEspresso\core\libraries\rest_api\calculations\Datetime', |
52
|
|
|
[ |
53
|
|
|
'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
54
|
|
|
'EEM_Registration' => EE_Dependency_Map::load_from_cache |
55
|
|
|
] |
56
|
|
|
); |
57
|
|
|
$this->dependency_map->registerDependencies( |
58
|
|
|
'EventEspresso\core\libraries\rest_api\calculations\Event', |
59
|
|
|
[ |
60
|
|
|
'EEM_Event' => EE_Dependency_Map::load_from_cache, |
61
|
|
|
'EEM_Registration' => EE_Dependency_Map::load_from_cache |
62
|
|
|
] |
63
|
|
|
); |
64
|
|
|
$this->dependency_map->registerDependencies( |
65
|
|
|
'EventEspresso\core\libraries\rest_api\calculations\Registration', |
66
|
|
|
['EEM_Registration' => EE_Dependency_Map::load_from_cache] |
67
|
|
|
); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* implements logic required to run during request |
73
|
|
|
* |
74
|
|
|
* @return bool |
75
|
|
|
* @since $VID:$ |
76
|
|
|
*/ |
77
|
|
|
protected function requestHandler() |
78
|
|
|
{ |
79
|
|
|
// rest api handled by module for now |
80
|
|
|
return true; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|