@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; |
6 | 6 | |
7 | -trait AddFlashTrait{ |
|
7 | +trait AddFlashTrait { |
|
8 | 8 | |
9 | 9 | private $flashBag; |
10 | 10 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | if ($event->getException() instanceof RedirectException) { |
31 | 31 | $redirectResponse = new RedirectResponse($event->getException()->getRedirectResponse()); |
32 | 32 | |
33 | - if($event->getException()->getMessage() !== ""){ |
|
33 | + if ($event->getException()->getMessage() !== "") { |
|
34 | 34 | $this->addFlash(FlashMessageCategory::ERROR, $event->getException()->getMessage()); |
35 | 35 | } |
36 | 36 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | return $this->redirectResponse; |
31 | 31 | } |
32 | 32 | |
33 | - public function getRedirectMessage(){ |
|
33 | + public function getRedirectMessage() { |
|
34 | 34 | return $this->redirectMessage; |
35 | 35 | } |
36 | 36 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * @param $historyId |
39 | 39 | * Revert a trick to a history checkpoint. |
40 | 40 | */ |
41 | - public function revertToHistory($id, $historyId){ |
|
41 | + public function revertToHistory($id, $historyId) { |
|
42 | 42 | $trick = $this->em->find('App\Entity\Trick', $id); |
43 | 43 | $this->repo->revert($trick, $historyId); |
44 | 44 | $this->em->persist($trick); |
@@ -16,16 +16,16 @@ |
||
16 | 16 | public function buildForm(FormBuilderInterface $builder, array $options) |
17 | 17 | { |
18 | 18 | $builder |
19 | - ->add('name', TextType::class,[ |
|
19 | + ->add('name', TextType::class, [ |
|
20 | 20 | 'label' => 'Name of the trick, must be at least 5 characters' |
21 | 21 | ]) |
22 | - ->add('text', TextareaType::class ,[ |
|
22 | + ->add('text', TextareaType::class, [ |
|
23 | 23 | 'label' => 'Describe the trick', |
24 | 24 | 'attr' => [ |
25 | 25 | 'class'=>'materialize-textarea' |
26 | 26 | ] |
27 | 27 | ]) |
28 | - ->add('category', EntityType::class,[ |
|
28 | + ->add('category', EntityType::class, [ |
|
29 | 29 | 'class' => Category::class, |
30 | 30 | 'choice_label' => 'Name', |
31 | 31 | ]) |
@@ -15,19 +15,19 @@ |
||
15 | 15 | $faker = Factory::create(); |
16 | 16 | |
17 | 17 | $categoryList = array(); |
18 | - for($i=0; $i<5; $i++){ |
|
18 | + for ($i = 0; $i < 5; $i++) { |
|
19 | 19 | $category = new Category(); |
20 | 20 | $categoryList[] = $category->setName($faker->word); |
21 | 21 | $manager->persist($category); |
22 | 22 | } |
23 | 23 | |
24 | - for ($i=0; $i<25; $i++){ |
|
24 | + for ($i = 0; $i < 25; $i++) { |
|
25 | 25 | $trick = new Trick(); |
26 | 26 | $trick |
27 | 27 | ->setName($faker->words(3, true)) |
28 | 28 | ->setText($faker->paragraph()) |
29 | 29 | ->setCreatedAt($faker->dateTimeThisDecade()) |
30 | - ->setCategory($categoryList[rand(0,4)]); |
|
30 | + ->setCategory($categoryList[rand(0, 4)]); |
|
31 | 31 | ; |
32 | 32 | |
33 | 33 | $manager->persist($trick); |
@@ -25,8 +25,8 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | - * @Route("/search/{categoryId}", name="trick.search") |
|
29 | - */ |
|
28 | + * @Route("/search/{categoryId}", name="trick.search") |
|
29 | + */ |
|
30 | 30 | public function search($categoryId = "") |
31 | 31 | { |
32 | 32 | $categories = $this->categoryRepository->findAll(); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | { |
32 | 32 | $categories = $this->categoryRepository->findAll(); |
33 | 33 | $criteria = array(); |
34 | - if($categoryId !== ""){ |
|
34 | + if ($categoryId !== "") { |
|
35 | 35 | $criteria = array('category' => $categoryId); |
36 | 36 | } |
37 | 37 | $tricks = $this->trickRepository->findBy($criteria); |