@@ -56,7 +56,7 @@ |
||
56 | 56 | */ |
57 | 57 | protected function supports($attribute, $subject) |
58 | 58 | { |
59 | - if(is_object($subject)) { |
|
59 | + if (is_object($subject)) { |
|
60 | 60 | $permission_name = $this->instanceToPermissionName($subject); |
61 | 61 | //If permission name is null, then the subject is not supported |
62 | 62 | return ($permission_name !== null) && $this->resolver->isValidOperation($permission_name, $attribute); |
@@ -81,13 +81,13 @@ |
||
81 | 81 | { |
82 | 82 | parent::configureOptions($resolver); |
83 | 83 | |
84 | - $resolver->setDefault('group_name', function (Options $options) { |
|
84 | + $resolver->setDefault('group_name', function(Options $options) { |
|
85 | 85 | return trim($options['name']); |
86 | 86 | }); |
87 | 87 | |
88 | 88 | $resolver->setDefault('inherit', false); |
89 | 89 | |
90 | - $resolver->setDefault('label', function (Options $options) { |
|
90 | + $resolver->setDefault('label', function(Options $options) { |
|
91 | 91 | if (!empty($this->perm_structure['groups'][$options['group_name']]['label'])) { |
92 | 92 | return $this->perm_structure['groups'][$options['group_name']]['label']; |
93 | 93 | } |
@@ -71,12 +71,12 @@ |
||
71 | 71 | |
72 | 72 | $resolver->setRequired('property'); |
73 | 73 | |
74 | - $resolver->setDefault('field', function (Options $option) { |
|
75 | - return $option['property'] . '.name'; |
|
74 | + $resolver->setDefault('field', function(Options $option) { |
|
75 | + return $option['property'].'.name'; |
|
76 | 76 | }); |
77 | 77 | |
78 | - $resolver->setDefault('render', function (Options $options) { |
|
79 | - return function ($value, Part $context) use ($options) { |
|
78 | + $resolver->setDefault('render', function(Options $options) { |
|
79 | + return function($value, Part $context) use ($options) { |
|
80 | 80 | /** @var DBElement $entity */ |
81 | 81 | $entity = $this->accessor->getValue($context, $options['property']); |
82 | 82 |
@@ -138,7 +138,7 @@ |
||
138 | 138 | */ |
139 | 139 | public function getIDString(): string |
140 | 140 | { |
141 | - return 'P' . sprintf('%06d', $this->getID()); |
|
141 | + return 'P'.sprintf('%06d', $this->getID()); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | //Rebuild form, so it is based on the updated data. Important for the parent field! |
81 | 81 | //We can not use dynamic form events here, because the parent entity list is build from database! |
82 | 82 | $form = $this->createForm($this->form_class, $entity); |
83 | - } elseif ($form->isSubmitted() && ! $form->isValid()) { |
|
83 | + } elseif ($form->isSubmitted() && !$form->isValid()) { |
|
84 | 84 | $this->addFlash('error', $this->translator->trans('entity.edit_flash.invalid')); |
85 | 85 | } |
86 | 86 | |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | $em->flush(); |
108 | 108 | $this->addFlash('success', $this->translator->trans('entity.created_flash')); |
109 | 109 | |
110 | - return $this->redirectToRoute($this->route_base . '_edit', ['id' => $new_entity->getID()]); |
|
110 | + return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]); |
|
111 | 111 | } |
112 | 112 | |
113 | - if ($form->isSubmitted() && ! $form->isValid()) { |
|
113 | + if ($form->isSubmitted() && !$form->isValid()) { |
|
114 | 114 | $this->addFlash('error', $this->translator->trans('entity.created_flash.invalid')); |
115 | 115 | } |
116 | 116 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | foreach ($errors as $name => $error) { |
132 | 132 | /** @var $error ConstraintViolationList */ |
133 | - $this->addFlash('error', $name . ':' . $error); |
|
133 | + $this->addFlash('error', $name.':'.$error); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | //Show errors to user: |
150 | 150 | foreach ($errors as $name => $error) { |
151 | 151 | /** @var $error ConstraintViolationList */ |
152 | - $this->addFlash('error', $name . ':' . $error); |
|
152 | + $this->addFlash('error', $name.':'.$error); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $this->addFlash('success', 'attachment_type.deleted'); |
191 | 191 | } |
192 | 192 | |
193 | - return $this->redirectToRoute($this->route_base . '_new'); |
|
193 | + return $this->redirectToRoute($this->route_base.'_new'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | protected function _exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request) |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | $entities = $em->getRepository($this->entity_class)->findAll(); |
203 | 203 | |
204 | - return $exporter->exportEntityFromRequest($entities,$request); |
|
204 | + return $exporter->exportEntityFromRequest($entities, $request); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | protected function _exportEntity(NamedDBElement $entity, EntityExporter $exporter, Request $request) |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $attachments = $form['attachments']; |
91 | 91 | foreach ($attachments as $attachment) { |
92 | 92 | /** @var $attachment FormInterface */ |
93 | - $attachmentHelper->upload( $attachment->getData(), $attachment['file']->getData()); |
|
93 | + $attachmentHelper->upload($attachment->getData(), $attachment['file']->getData()); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $this->addFlash('info', $translator->trans('part.edited_flash')); |
100 | 100 | //Reload form, so the SIUnitType entries use the new part unit |
101 | 101 | $form = $this->createForm(PartBaseType::class, $part); |
102 | - } elseif ($form->isSubmitted() && ! $form->isValid()) { |
|
102 | + } elseif ($form->isSubmitted() && !$form->isValid()) { |
|
103 | 103 | $this->addFlash('error', $translator->trans('part.edited_flash.invalid')); |
104 | 104 | } |
105 | 105 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | { |
122 | 122 | $this->denyAccessUnlessGranted('delete', $part); |
123 | 123 | |
124 | - if ($this->isCsrfTokenValid('delete' . $part->getId(), $request->request->get('_token'))) { |
|
124 | + if ($this->isCsrfTokenValid('delete'.$part->getId(), $request->request->get('_token'))) { |
|
125 | 125 | $entityManager = $this->getDoctrine()->getManager(); |
126 | 126 | |
127 | 127 | //Remove part |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $attachments = $form['attachments']; |
166 | 166 | foreach ($attachments as $attachment) { |
167 | 167 | /** @var $attachment FormInterface */ |
168 | - $attachmentHelper->upload( $attachment->getData(), $attachment['file']->getData()); |
|
168 | + $attachmentHelper->upload($attachment->getData(), $attachment['file']->getData()); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | $em->persist($new_part); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]); |
176 | 176 | } |
177 | 177 | |
178 | - if ($form->isSubmitted() && ! $form->isValid()) { |
|
178 | + if ($form->isSubmitted() && !$form->isValid()) { |
|
179 | 179 | $this->addFlash('error', $translator->trans('part.created_flash.invalid')); |
180 | 180 | } |
181 | 181 |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | //Show permissions to user |
143 | - $builder = $this->createFormBuilder()->add('permissions',PermissionsType::class, [ |
|
143 | + $builder = $this->createFormBuilder()->add('permissions', PermissionsType::class, [ |
|
144 | 144 | 'mapped' => false, |
145 | 145 | 'disabled' => true, |
146 | 146 | 'inherit' => true, |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | $user = $this->getUser(); |
166 | 166 | |
167 | - if(!$user instanceof User) { |
|
167 | + if (!$user instanceof User) { |
|
168 | 168 | return new \RuntimeException("This controller only works only for Part-DB User objects!"); |
169 | 169 | } |
170 | 170 |
@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | //$new_url = str_replace($request->getPathInfo(), '/' . $locale . $request->getPathInfo(), $request->getUri()); |
71 | - $new_url = $request->getUriForPath('/' . $locale . $request->getPathInfo()); |
|
71 | + $new_url = $request->getUriForPath('/'.$locale.$request->getPathInfo()); |
|
72 | 72 | return $this->redirect($new_url); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |