Completed
Push — master ( 08f5ac...8a193d )
by Iakov
03:27
created
Manager/ApiManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -107,18 +107,18 @@  discard block
 block discarded – undo
107 107
     public function filter(Request $request)
108 108
     {
109 109
         $entity = new \ReflectionClass($request->attributes->get('_entity'));
110
-        if(!$this->accessManager->canAccessResource($entity)) {
110
+        if (!$this->accessManager->canAccessResource($entity)) {
111 111
             throw new AccessDeniedHttpException();
112 112
         }
113 113
         $builder = $this->doctrine->getRepository($entity->getName())->createQueryBuilder('e');
114 114
 
115 115
         $sort = $request->get('sort');
116
-        if($sort) {
117
-            $sort = lcfirst(implode('', array_map(function ($key) {
116
+        if ($sort) {
117
+            $sort = lcfirst(implode('', array_map(function($key) {
118 118
                 return ucfirst($key);
119 119
             }, explode('_', $sort))));
120 120
 
121
-            if(!$entity->hasProperty($sort)) {
121
+            if (!$entity->hasProperty($sort)) {
122 122
                 throw new BadRequestHttpException(sprintf('There is no such field %s', $sort));
123 123
             }
124 124
             $builder->orderBy(
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
             );
128 128
         }
129 129
 
130
-        foreach($entity->getProperties() as $property) {
130
+        foreach ($entity->getProperties() as $property) {
131 131
             $name = $property->getName();
132
-            if($value = $request->get($name)) {
132
+            if ($value = $request->get($name)) {
133 133
                 $builder->andWhere($builder->expr()->orX(
134 134
                     $builder->expr()->like('e.'.$name, ':value')
135 135
                 ));
Please login to merge, or discard this patch.