]> Raphaël G. Git Repositories - airbundle/blob - Command.php
Remove body template
[airbundle] / Command.php
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Rapsys AirBundle package.
5 *
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Rapsys\AirBundle;
13
14 use Doctrine\Persistence\ManagerRegistry;
15 use Symfony\Component\Console\Command\Command as BaseCommand;
16 use Symfony\Component\Routing\RouterInterface;
17 use Symfony\Contracts\Translation\TranslatorInterface;
18
19 use Rapsys\AirBundle\RapsysAirBundle;
20
21 use Rapsys\PackBundle\Util\SluggerUtil;
22
23 class Command extends BaseCommand {
24 /**
25 * Creates new command
26 *
27 * @param ManagerRegistry $doctrine The doctrine instance
28 * @param RouterInterface $router The router instance
29 * @param SluggerUtil $slugger The slugger instance
30 * @param TranslatorInterface $translator The translator instance
31 * @param string $locale The default locale
32 */
33 public function __construct(protected ManagerRegistry $doctrine, protected RouterInterface $router, protected SluggerUtil $slugger, protected TranslatorInterface $translator, protected string $locale) {
34 //Call parent constructor
35 parent::__construct();
36
37 //Get router context
38 $context = $this->router->getContext();
39
40 //Set host
41 //TODO: set it in env RAPSYSAIR_HOST ?
42 $context->setHost('airlibre.eu');
43
44 //Set scheme
45 //TODO: set it in env RAPSYSAIR_SCHEME ?
46 $context->setScheme('https');
47
48 //With default name
49 //TODO: XXX: see how to make it works
50 /*if (isset(self::$defaultName)) {
51 $this->name = self::$defaultName;
52 }
53
54 //With default description
55 if (isset(self::$defaultDescription)) {
56 $this->name = self::$defaultDescription;
57 }*/
58 }
59
60 /**
61 * Return the bundle alias
62 *
63 * {@inheritdoc}
64 */
65 public function getAlias(): string {
66 return RapsysAirBundle::getAlias();
67 }
68 }