1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Daken\ReleaseProfilerBundle\Admin; |
4
|
|
|
|
5
|
|
|
use Sonata\AdminBundle\Admin\Admin; |
6
|
|
|
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
7
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper; |
8
|
|
|
use Sonata\AdminBundle\Route\RouteCollection; |
9
|
|
|
use Sonata\AdminBundle\Show\ShowMapper; |
10
|
|
|
|
11
|
|
|
class RequestAdmin extends Admin |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
protected $datagridValues = [ |
14
|
|
|
'_page' => 1, |
15
|
|
|
'_sort_order' => 'DESC', |
16
|
|
|
'_sort_by' => 'id' |
17
|
|
|
]; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @param DatagridMapper $datagridMapper |
21
|
|
|
*/ |
22
|
|
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
23
|
|
|
{ |
24
|
|
|
$datagridMapper |
25
|
|
|
->add('id') |
26
|
|
|
->add('created') |
27
|
|
|
->add('scheme') |
28
|
|
|
->add('host') |
29
|
|
|
->add('path') |
30
|
|
|
->add('query') |
31
|
|
|
->add('matchedRoute') |
32
|
|
|
->add('time') |
33
|
|
|
->add('requestMethod') |
34
|
|
|
->add('responseCode') |
35
|
|
|
->add('clientIp') |
36
|
|
|
; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param ListMapper $listMapper |
41
|
|
|
*/ |
42
|
|
|
protected function configureListFields(ListMapper $listMapper) |
43
|
|
|
{ |
44
|
|
|
$listMapper |
45
|
|
|
->addIdentifier('id') |
46
|
|
|
->add('created') |
47
|
|
|
->add('scheme') |
48
|
|
|
->add('host') |
49
|
|
|
->add('path') |
50
|
|
|
->add('matchedRoute') |
51
|
|
|
->add('time') |
52
|
|
|
->add('totalDatabaseQueryCount', null, array('label' => 'DB Queries')) |
53
|
|
|
->add('requestMethod', null, array('label' => 'Method')) |
54
|
|
|
->add('responseCode') |
55
|
|
|
->add('clientIp') |
56
|
|
|
; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param ShowMapper $showMapper |
61
|
|
|
*/ |
62
|
|
|
protected function configureShowFields(ShowMapper $showMapper) |
63
|
|
|
{ |
64
|
|
|
$showMapper |
65
|
|
|
->add('id') |
66
|
|
|
->add('created') |
67
|
|
|
->add('scheme') |
68
|
|
|
->add('host') |
69
|
|
|
->add('path') |
70
|
|
|
->add('query') |
71
|
|
|
->add('matchedRoute') |
72
|
|
|
->add('time') |
73
|
|
|
->add('totalDatabaseQueryCount') |
74
|
|
|
->add('totalDatabaseQueryTime') |
75
|
|
|
->add('requestMethod') |
76
|
|
|
->add('request', null, ['safe' => true]) |
77
|
|
|
->add('responseCode') |
78
|
|
|
->add('responseAsString', null, ['safe' => false, 'label' => 'Response body']) |
79
|
|
|
->add('clientIp') |
80
|
|
|
->add('username') |
81
|
|
|
->end() |
82
|
|
|
|
83
|
|
|
->with('Database Queries') |
84
|
|
|
->add('databaseQueries', null, array( |
85
|
|
|
'template' => 'DakenReleaseProfilerBundle:Admin:request_queries.html.twig', |
86
|
|
|
)) |
87
|
|
|
->end() |
88
|
|
|
|
89
|
|
|
->with('Errors') |
90
|
|
|
->add('errors', null, array( |
91
|
|
|
'template' => 'DakenReleaseProfilerBundle:Admin:request_errors.html.twig', |
92
|
|
|
)) |
93
|
|
|
->end() |
94
|
|
|
; |
95
|
|
|
; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
protected function configureRoutes(RouteCollection $collection) |
99
|
|
|
{ |
100
|
|
|
$collection->remove('edit'); |
101
|
|
|
$collection->remove('create'); |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.