@@ -11,17 +11,17 @@ |
||
11 | 11 | |
12 | 12 | class LoginController extends AbstractController |
13 | 13 | { |
14 | - /** |
|
15 | - * @Route("/login/", name="ribsadmin_login") |
|
16 | - * @param CsrfTokenManagerInterface $token |
|
17 | - * @param AuthenticationUtils $auth_utils |
|
18 | - * @return Response |
|
19 | - */ |
|
14 | + /** |
|
15 | + * @Route("/login/", name="ribsadmin_login") |
|
16 | + * @param CsrfTokenManagerInterface $token |
|
17 | + * @param AuthenticationUtils $auth_utils |
|
18 | + * @return Response |
|
19 | + */ |
|
20 | 20 | public function loginAction(AuthenticationUtils $auth_utils): Response |
21 | 21 | { |
22 | - $csrf_token = $this->has('security.csrf.token_manager') |
|
23 | - ? $this->get('security.csrf.token_manager')->getToken('authenticate')->getValue() |
|
24 | - : null; |
|
22 | + $csrf_token = $this->has('security.csrf.token_manager') |
|
23 | + ? $this->get('security.csrf.token_manager')->getToken('authenticate')->getValue() |
|
24 | + : null; |
|
25 | 25 | |
26 | 26 | if ($auth_utils->getLastAuthenticationError()) { |
27 | 27 | $this->addFlash("error-flash", "Your login or password are incorrect"); |
@@ -7,8 +7,8 @@ |
||
7 | 7 | |
8 | 8 | class RibsAdminBundle extends Bundle |
9 | 9 | { |
10 | - public function getContainerExtension() |
|
11 | - { |
|
12 | - return new RibsAdminExtension(); |
|
13 | - } |
|
10 | + public function getContainerExtension() |
|
11 | + { |
|
12 | + return new RibsAdminExtension(); |
|
13 | + } |
|
14 | 14 | } |
@@ -10,12 +10,12 @@ |
||
10 | 10 | |
11 | 11 | class RibsAdminExtension extends Extension |
12 | 12 | { |
13 | - public function load(array $configs, ContainerBuilder $container) |
|
14 | - { |
|
15 | - $loader = new YamlFileLoader( |
|
16 | - $container, |
|
17 | - new FileLocator(__DIR__.'/../Resources/config') |
|
18 | - ); |
|
19 | - $loader->load('services.yml'); |
|
20 | - } |
|
13 | + public function load(array $configs, ContainerBuilder $container) |
|
14 | + { |
|
15 | + $loader = new YamlFileLoader( |
|
16 | + $container, |
|
17 | + new FileLocator(__DIR__.'/../Resources/config') |
|
18 | + ); |
|
19 | + $loader->load('services.yml'); |
|
20 | + } |
|
21 | 21 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | { |
15 | 15 | $loader = new YamlFileLoader( |
16 | 16 | $container, |
17 | - new FileLocator(__DIR__.'/../Resources/config') |
|
17 | + new FileLocator(__DIR__ . '/../Resources/config') |
|
18 | 18 | ); |
19 | 19 | $loader->load('services.yml'); |
20 | 20 | } |
@@ -26,22 +26,22 @@ discard block |
||
26 | 26 | "label" => "Package name", |
27 | 27 | "required" => true |
28 | 28 | ]) |
29 | - ->add("titleTag", TextType::class, [ |
|
30 | - "label" => "Title tag", |
|
31 | - "required" => true |
|
32 | - ]) |
|
33 | - ->add("descriptionTag", TextareaType::class, [ |
|
34 | - "label" => "Description tag", |
|
35 | - "required" => true, |
|
36 | - ]) |
|
37 | - ->add("url", TextType::class, [ |
|
38 | - "label" => "Url", |
|
39 | - "required" => true |
|
40 | - ]) |
|
41 | - ->add("urlAdmin", TextType::class, [ |
|
42 | - "label" => "Admin url", |
|
43 | - "required" => true |
|
44 | - ]) |
|
29 | + ->add("titleTag", TextType::class, [ |
|
30 | + "label" => "Title tag", |
|
31 | + "required" => true |
|
32 | + ]) |
|
33 | + ->add("descriptionTag", TextareaType::class, [ |
|
34 | + "label" => "Description tag", |
|
35 | + "required" => true, |
|
36 | + ]) |
|
37 | + ->add("url", TextType::class, [ |
|
38 | + "label" => "Url", |
|
39 | + "required" => true |
|
40 | + ]) |
|
41 | + ->add("urlAdmin", TextType::class, [ |
|
42 | + "label" => "Admin url", |
|
43 | + "required" => true |
|
44 | + ]) |
|
45 | 45 | ->add("active", CheckboxType::class, [ |
46 | 46 | "label" => "Enable module", |
47 | 47 | "attr" => [ |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | ], |
50 | 50 | "required" => false |
51 | 51 | ]) |
52 | - ->add("displayed", CheckboxType::class, [ |
|
53 | - "label" => "Display module in navigation", |
|
54 | - "attr" => [ |
|
55 | - "class" => "ribs-checkbox switched cxs-2 no-pl" |
|
56 | - ], |
|
57 | - "required" => false |
|
58 | - ]) |
|
59 | - ->add('submit', SubmitType::class, [ |
|
60 | - 'label' => 'Validate', |
|
61 | - 'attr' => [] |
|
62 | - ]); |
|
52 | + ->add("displayed", CheckboxType::class, [ |
|
53 | + "label" => "Display module in navigation", |
|
54 | + "attr" => [ |
|
55 | + "class" => "ribs-checkbox switched cxs-2 no-pl" |
|
56 | + ], |
|
57 | + "required" => false |
|
58 | + ]) |
|
59 | + ->add('submit', SubmitType::class, [ |
|
60 | + 'label' => 'Validate', |
|
61 | + 'attr' => [] |
|
62 | + ]); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function configureOptions(OptionsResolver $resolver) |
@@ -80,7 +80,7 @@ |
||
80 | 80 | $account->setPassword($temp_password); |
81 | 81 | $account->setUser($user); |
82 | 82 | $account->setEmail($email); |
83 | - $account->setUsername(substr($firstname, 0, 1).".".$lastname); |
|
83 | + $account->setUsername(substr($firstname, 0, 1) . "." . $lastname); |
|
84 | 84 | $this->em->persist($account); |
85 | 85 | |
86 | 86 | $this->em->flush(); |
@@ -13,80 +13,80 @@ |
||
13 | 13 | |
14 | 14 | class CreateAdminCommand extends Command |
15 | 15 | { |
16 | - /** @var EntityManagerInterface */ |
|
17 | - private $em; |
|
16 | + /** @var EntityManagerInterface */ |
|
17 | + private $em; |
|
18 | 18 | |
19 | - /** @var UserPasswordEncoderInterface */ |
|
20 | - private $passwordEncoder; |
|
19 | + /** @var UserPasswordEncoderInterface */ |
|
20 | + private $passwordEncoder; |
|
21 | 21 | |
22 | - /** |
|
23 | - * CreateAdminCommand constructor. |
|
24 | - * @param EntityManagerInterface $em |
|
25 | - * @param UserPasswordEncoderInterface $passwordEncoder |
|
26 | - * @param string|null $name |
|
27 | - */ |
|
28 | - public function __construct(EntityManagerInterface $em, UserPasswordEncoderInterface $passwordEncoder, string $name = null) |
|
29 | - { |
|
30 | - parent::__construct($name); |
|
31 | - $this->em = $em; |
|
32 | - $this->passwordEncoder = $passwordEncoder; |
|
33 | - } |
|
22 | + /** |
|
23 | + * CreateAdminCommand constructor. |
|
24 | + * @param EntityManagerInterface $em |
|
25 | + * @param UserPasswordEncoderInterface $passwordEncoder |
|
26 | + * @param string|null $name |
|
27 | + */ |
|
28 | + public function __construct(EntityManagerInterface $em, UserPasswordEncoderInterface $passwordEncoder, string $name = null) |
|
29 | + { |
|
30 | + parent::__construct($name); |
|
31 | + $this->em = $em; |
|
32 | + $this->passwordEncoder = $passwordEncoder; |
|
33 | + } |
|
34 | 34 | |
35 | - protected function configure() |
|
36 | - { |
|
37 | - $this |
|
38 | - ->setName('ribsadmin:create-admin') |
|
39 | - ->setDescription('Create an admin in ribs admin') |
|
40 | - ->addArgument( |
|
41 | - 'firstname', |
|
42 | - InputArgument::REQUIRED, |
|
43 | - 'Firstname of admin to create' |
|
44 | - ) |
|
45 | - ->addArgument( |
|
46 | - 'lastname', |
|
47 | - InputArgument::REQUIRED, |
|
48 | - 'Lastname of admin to create' |
|
49 | - ) |
|
50 | - ->addArgument( |
|
51 | - 'email', |
|
52 | - InputArgument::REQUIRED, |
|
53 | - 'email of admin to create' |
|
54 | - ) |
|
55 | - ->addArgument( |
|
56 | - 'password', |
|
57 | - InputArgument::REQUIRED, |
|
58 | - 'password of admin to create' |
|
59 | - ) |
|
60 | - ; |
|
61 | - } |
|
35 | + protected function configure() |
|
36 | + { |
|
37 | + $this |
|
38 | + ->setName('ribsadmin:create-admin') |
|
39 | + ->setDescription('Create an admin in ribs admin') |
|
40 | + ->addArgument( |
|
41 | + 'firstname', |
|
42 | + InputArgument::REQUIRED, |
|
43 | + 'Firstname of admin to create' |
|
44 | + ) |
|
45 | + ->addArgument( |
|
46 | + 'lastname', |
|
47 | + InputArgument::REQUIRED, |
|
48 | + 'Lastname of admin to create' |
|
49 | + ) |
|
50 | + ->addArgument( |
|
51 | + 'email', |
|
52 | + InputArgument::REQUIRED, |
|
53 | + 'email of admin to create' |
|
54 | + ) |
|
55 | + ->addArgument( |
|
56 | + 'password', |
|
57 | + InputArgument::REQUIRED, |
|
58 | + 'password of admin to create' |
|
59 | + ) |
|
60 | + ; |
|
61 | + } |
|
62 | 62 | |
63 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
64 | - { |
|
65 | - $firstname = $input->getArgument('firstname'); |
|
66 | - $lastname = $input->getArgument('lastname'); |
|
67 | - $email = $input->getArgument('email'); |
|
68 | - $password = $input->getArgument('password'); |
|
63 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
64 | + { |
|
65 | + $firstname = $input->getArgument('firstname'); |
|
66 | + $lastname = $input->getArgument('lastname'); |
|
67 | + $email = $input->getArgument('email'); |
|
68 | + $password = $input->getArgument('password'); |
|
69 | 69 | |
70 | - $output->writeln("Create admin " . $firstname . " " . $lastname); |
|
70 | + $output->writeln("Create admin " . $firstname . " " . $lastname); |
|
71 | 71 | |
72 | - $user = new User(); |
|
73 | - $user->setFirstname($firstname); |
|
74 | - $user->setLastname($lastname); |
|
75 | - $user->setAccessRights("*"); |
|
76 | - $this->em->persist($user); |
|
72 | + $user = new User(); |
|
73 | + $user->setFirstname($firstname); |
|
74 | + $user->setLastname($lastname); |
|
75 | + $user->setAccessRights("*"); |
|
76 | + $this->em->persist($user); |
|
77 | 77 | |
78 | - $account = new Account(); |
|
79 | - $temp_password = $this->passwordEncoder->encodePassword($account, $password); |
|
80 | - $account->setPassword($temp_password); |
|
81 | - $account->setUser($user); |
|
82 | - $account->setEmail($email); |
|
83 | - $account->setUsername(substr($firstname, 0, 1).".".$lastname); |
|
84 | - $this->em->persist($account); |
|
78 | + $account = new Account(); |
|
79 | + $temp_password = $this->passwordEncoder->encodePassword($account, $password); |
|
80 | + $account->setPassword($temp_password); |
|
81 | + $account->setUser($user); |
|
82 | + $account->setEmail($email); |
|
83 | + $account->setUsername(substr($firstname, 0, 1).".".$lastname); |
|
84 | + $this->em->persist($account); |
|
85 | 85 | |
86 | - $this->em->flush(); |
|
86 | + $this->em->flush(); |
|
87 | 87 | |
88 | - $output->writeln("End Create admin " . $firstname . " " . $lastname); |
|
88 | + $output->writeln("End Create admin " . $firstname . " " . $lastname); |
|
89 | 89 | |
90 | - return 0; |
|
91 | - } |
|
90 | + return 0; |
|
91 | + } |
|
92 | 92 | } |
@@ -11,83 +11,83 @@ |
||
11 | 11 | |
12 | 12 | class ModuleController extends AbstractController |
13 | 13 | { |
14 | - /** |
|
15 | - * @Route("/modules/", name="ribsadmin_modules") |
|
16 | - * @return Response |
|
17 | - * function that return a list of all modules |
|
18 | - */ |
|
19 | - public function List(): Response |
|
20 | - { |
|
21 | - $em = $this->getDoctrine()->getManager(); |
|
14 | + /** |
|
15 | + * @Route("/modules/", name="ribsadmin_modules") |
|
16 | + * @return Response |
|
17 | + * function that return a list of all modules |
|
18 | + */ |
|
19 | + public function List(): Response |
|
20 | + { |
|
21 | + $em = $this->getDoctrine()->getManager(); |
|
22 | 22 | |
23 | - $modules = $em->getRepository(Module::class)->findBy([], ['titleTag' => 'ASC']); |
|
23 | + $modules = $em->getRepository(Module::class)->findBy([], ['titleTag' => 'ASC']); |
|
24 | 24 | |
25 | - return $this->render('@RibsAdmin/modules/list.html.twig', [ |
|
26 | - "modules" => $modules, |
|
27 | - ]); |
|
28 | - } |
|
25 | + return $this->render('@RibsAdmin/modules/list.html.twig', [ |
|
26 | + "modules" => $modules, |
|
27 | + ]); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * @Route("/modules/create/", name="ribsadmin_modules_create") |
|
32 | - * @Route("/modules/edit/{id}", name="ribsadmin_modules_edit") |
|
33 | - * @param Request $request |
|
34 | - * @param int|null $id |
|
35 | - * @return Response |
|
36 | - * method to edit a module |
|
37 | - */ |
|
38 | - public function edit(Request $request, int $id = null): Response |
|
39 | - { |
|
40 | - $em = $this->getDoctrine()->getManager(); |
|
30 | + /** |
|
31 | + * @Route("/modules/create/", name="ribsadmin_modules_create") |
|
32 | + * @Route("/modules/edit/{id}", name="ribsadmin_modules_edit") |
|
33 | + * @param Request $request |
|
34 | + * @param int|null $id |
|
35 | + * @return Response |
|
36 | + * method to edit a module |
|
37 | + */ |
|
38 | + public function edit(Request $request, int $id = null): Response |
|
39 | + { |
|
40 | + $em = $this->getDoctrine()->getManager(); |
|
41 | 41 | |
42 | - if (!$id) { |
|
43 | - $module = new Module(); |
|
44 | - $text = "created"; |
|
45 | - } else { |
|
46 | - $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
47 | - $text = "edited"; |
|
48 | - } |
|
42 | + if (!$id) { |
|
43 | + $module = new Module(); |
|
44 | + $text = "created"; |
|
45 | + } else { |
|
46 | + $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
47 | + $text = "edited"; |
|
48 | + } |
|
49 | 49 | |
50 | - $form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Module::class, $module); |
|
51 | - $form->handleRequest($request); |
|
50 | + $form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Module::class, $module); |
|
51 | + $form->handleRequest($request); |
|
52 | 52 | |
53 | - if ($form->isSubmitted() && $form->isValid()) { |
|
54 | - /** @var Module $data */ |
|
55 | - $data = $form->getData(); |
|
56 | - $em->persist($data); |
|
57 | - $em->flush(); |
|
58 | - $this->addFlash("success-flash", "Module ". $data->getTitleTag() . " was " . $text); |
|
53 | + if ($form->isSubmitted() && $form->isValid()) { |
|
54 | + /** @var Module $data */ |
|
55 | + $data = $form->getData(); |
|
56 | + $em->persist($data); |
|
57 | + $em->flush(); |
|
58 | + $this->addFlash("success-flash", "Module ". $data->getTitleTag() . " was " . $text); |
|
59 | 59 | |
60 | - return $this->redirectToRoute("ribsadmin_modules"); |
|
61 | - } |
|
60 | + return $this->redirectToRoute("ribsadmin_modules"); |
|
61 | + } |
|
62 | 62 | |
63 | - return $this->render("@RibsAdmin/modules/edit.html.twig", [ |
|
64 | - "form" => $form->createView(), |
|
65 | - "form_errors" => $form->getErrors(), |
|
66 | - "module" => $module |
|
67 | - ]); |
|
68 | - } |
|
63 | + return $this->render("@RibsAdmin/modules/edit.html.twig", [ |
|
64 | + "form" => $form->createView(), |
|
65 | + "form_errors" => $form->getErrors(), |
|
66 | + "module" => $module |
|
67 | + ]); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @Route("/modules/delete/{id}", name="ribsadmin_modules_delete") |
|
72 | - * @param Request $request |
|
73 | - * @param int $id |
|
74 | - * @return RedirectResponse |
|
75 | - * method to delete a module |
|
76 | - */ |
|
77 | - public function delete(Request $request, int $id): RedirectResponse |
|
78 | - { |
|
79 | - $em = $this->getDoctrine()->getManager(); |
|
80 | - $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
70 | + /** |
|
71 | + * @Route("/modules/delete/{id}", name="ribsadmin_modules_delete") |
|
72 | + * @param Request $request |
|
73 | + * @param int $id |
|
74 | + * @return RedirectResponse |
|
75 | + * method to delete a module |
|
76 | + */ |
|
77 | + public function delete(Request $request, int $id): RedirectResponse |
|
78 | + { |
|
79 | + $em = $this->getDoctrine()->getManager(); |
|
80 | + $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
81 | 81 | |
82 | - if ($module) { |
|
83 | - $name = $module->getTitle(); |
|
84 | - $em->remove($module); |
|
85 | - $em->flush(); |
|
86 | - $this->addFlash("success-flash", "Module " . $name . " was deleted"); |
|
87 | - } else { |
|
88 | - $this->addFlash("error-flash", "An error occured, module doesn't found"); |
|
89 | - } |
|
82 | + if ($module) { |
|
83 | + $name = $module->getTitle(); |
|
84 | + $em->remove($module); |
|
85 | + $em->flush(); |
|
86 | + $this->addFlash("success-flash", "Module " . $name . " was deleted"); |
|
87 | + } else { |
|
88 | + $this->addFlash("error-flash", "An error occured, module doesn't found"); |
|
89 | + } |
|
90 | 90 | |
91 | - return $this->redirectToRoute("ribsadmin_modules"); |
|
92 | - } |
|
91 | + return $this->redirectToRoute("ribsadmin_modules"); |
|
92 | + } |
|
93 | 93 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $data = $form->getData(); |
56 | 56 | $em->persist($data); |
57 | 57 | $em->flush(); |
58 | - $this->addFlash("success-flash", "Module ". $data->getTitleTag() . " was " . $text); |
|
58 | + $this->addFlash("success-flash", "Module " . $data->getTitleTag() . " was " . $text); |
|
59 | 59 | |
60 | 60 | return $this->redirectToRoute("ribsadmin_modules"); |
61 | 61 | } |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | private $container; |
13 | 13 | |
14 | - /** |
|
15 | - * Globals constructor. |
|
16 | - * @param ContainerInterface $container |
|
17 | - */ |
|
18 | - public function __construct(ContainerInterface $container) |
|
14 | + /** |
|
15 | + * Globals constructor. |
|
16 | + * @param ContainerInterface $container |
|
17 | + */ |
|
18 | + public function __construct(ContainerInterface $container) |
|
19 | 19 | { |
20 | 20 | $this->container = $container; |
21 | 21 | } |
@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | return $package_name; |
39 | 39 | } |
40 | 40 | |
41 | - /** |
|
42 | - * this method send base bundle path related to ribs-admin |
|
43 | - * @param string|null $package |
|
44 | - * @param bool $dev_mode |
|
45 | - * @return string |
|
46 | - */ |
|
41 | + /** |
|
42 | + * this method send base bundle path related to ribs-admin |
|
43 | + * @param string|null $package |
|
44 | + * @param bool $dev_mode |
|
45 | + * @return string |
|
46 | + */ |
|
47 | 47 | public function getBaseBundlePath(string $package = "piou-piou/ribs-admin-bundle", bool $dev_mode = false): string |
48 | 48 | { |
49 | 49 | $path = $this->container->get('kernel')->getProjectDir(); |
50 | 50 | |
51 | - $dev_mode = $package === "piou-piou/ribs-admin-bundle" ? $this->container->getParameter("ribs_admin")["dev_mode"] : $dev_mode; |
|
51 | + $dev_mode = $package === "piou-piou/ribs-admin-bundle" ? $this->container->getParameter("ribs_admin")["dev_mode"] : $dev_mode; |
|
52 | 52 | |
53 | 53 | if ($dev_mode === true) { |
54 | 54 | $package = "/lib/".$this->getPackageDevName($package); |
55 | 55 | } else { |
56 | - $package = "/vendor/" . $package; |
|
57 | - } |
|
56 | + $package = "/vendor/" . $package; |
|
57 | + } |
|
58 | 58 | |
59 | 59 | return $path . $package; |
60 | 60 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $dev_mode = $package === "piou-piou/ribs-admin-bundle" ? $this->container->getParameter("ribs_admin")["dev_mode"] : $dev_mode; |
52 | 52 | |
53 | 53 | if ($dev_mode === true) { |
54 | - $package = "/lib/".$this->getPackageDevName($package); |
|
54 | + $package = "/lib/" . $this->getPackageDevName($package); |
|
55 | 55 | } else { |
56 | 56 | $package = "/vendor/" . $package; |
57 | 57 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | ], |
21 | 21 | "mapped" => false |
22 | 22 | ]) |
23 | - ->add($options["autocomplete_name"]."_id", HiddenType::class, [ |
|
23 | + ->add($options["autocomplete_name"] . "_id", HiddenType::class, [ |
|
24 | 24 | "mapped" => false |
25 | 25 | ]); |
26 | 26 | } |
@@ -10,28 +10,28 @@ |
||
10 | 10 | |
11 | 11 | class AutocompleteType extends AbstractType |
12 | 12 | { |
13 | - public function buildForm(FormBuilderInterface $builder, array $options) |
|
14 | - { |
|
15 | - $builder |
|
16 | - ->add($options["autocomplete_name"], TextType::class, [ |
|
17 | - "label" => false, |
|
18 | - "attr" => [ |
|
19 | - "class" => "input-autocomplete", |
|
20 | - "data-url" => $options["data_url"], |
|
21 | - "autocomplete" => "off" |
|
22 | - ], |
|
23 | - "mapped" => false |
|
24 | - ]) |
|
25 | - ->add($options["autocomplete_name"]."_id", HiddenType::class, [ |
|
26 | - "mapped" => false |
|
27 | - ]); |
|
28 | - } |
|
13 | + public function buildForm(FormBuilderInterface $builder, array $options) |
|
14 | + { |
|
15 | + $builder |
|
16 | + ->add($options["autocomplete_name"], TextType::class, [ |
|
17 | + "label" => false, |
|
18 | + "attr" => [ |
|
19 | + "class" => "input-autocomplete", |
|
20 | + "data-url" => $options["data_url"], |
|
21 | + "autocomplete" => "off" |
|
22 | + ], |
|
23 | + "mapped" => false |
|
24 | + ]) |
|
25 | + ->add($options["autocomplete_name"]."_id", HiddenType::class, [ |
|
26 | + "mapped" => false |
|
27 | + ]); |
|
28 | + } |
|
29 | 29 | |
30 | - public function configureOptions(OptionsResolver $resolver) |
|
31 | - { |
|
32 | - $resolver->setDefaults([ |
|
33 | - "autocomplete_name" => null, |
|
34 | - "data_url" => null, |
|
35 | - ]); |
|
36 | - } |
|
30 | + public function configureOptions(OptionsResolver $resolver) |
|
31 | + { |
|
32 | + $resolver->setDefaults([ |
|
33 | + "autocomplete_name" => null, |
|
34 | + "data_url" => null, |
|
35 | + ]); |
|
36 | + } |
|
37 | 37 | } |
@@ -8,23 +8,23 @@ |
||
8 | 8 | |
9 | 9 | class AccountTokenRepository extends EntityRepository |
10 | 10 | { |
11 | - /** |
|
12 | - * method to find UserToken to archive |
|
13 | - * @param int $max_inactivation_days |
|
14 | - * @return mixed |
|
15 | - * @throws Exception |
|
16 | - */ |
|
17 | - public function findByExpiredToken(int $max_inactivation_days) |
|
18 | - { |
|
19 | - $now = new \DateTime(); |
|
20 | - $now->sub(new \DateInterval("P" . $max_inactivation_days . "D")); |
|
11 | + /** |
|
12 | + * method to find UserToken to archive |
|
13 | + * @param int $max_inactivation_days |
|
14 | + * @return mixed |
|
15 | + * @throws Exception |
|
16 | + */ |
|
17 | + public function findByExpiredToken(int $max_inactivation_days) |
|
18 | + { |
|
19 | + $now = new \DateTime(); |
|
20 | + $now->sub(new \DateInterval("P" . $max_inactivation_days . "D")); |
|
21 | 21 | |
22 | - $query = $this->getEntityManager()->createQuery("SELECT u FROM App:AccountToken u WHERE |
|
22 | + $query = $this->getEntityManager()->createQuery("SELECT u FROM App:AccountToken u WHERE |
|
23 | 23 | u.endToken < :max_inactivation_days |
24 | 24 | "); |
25 | 25 | |
26 | - $query->setParameter("max_inactivation_days", $now, Type::DATETIME); |
|
26 | + $query->setParameter("max_inactivation_days", $now, Type::DATETIME); |
|
27 | 27 | |
28 | - return $query->getResult(); |
|
29 | - } |
|
28 | + return $query->getResult(); |
|
29 | + } |
|
30 | 30 | } |