mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
Use FQCN instead of service alias
This commit is contained in:
parent
156158673f
commit
eb43c78720
62 changed files with 579 additions and 404 deletions
|
@ -2,8 +2,12 @@
|
|||
|
||||
namespace Wallabag\CoreBundle\Command;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use FOS\UserBundle\Event\UserEvent;
|
||||
use FOS\UserBundle\FOSUserEvents;
|
||||
use FOS\UserBundle\Model\UserManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -12,6 +16,7 @@ use Symfony\Component\Console\Output\BufferedOutput;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
|
||||
use Wallabag\CoreBundle\Entity\InternalSetting;
|
||||
|
||||
|
@ -72,7 +77,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
{
|
||||
$this->io->section('Step 1 of 4: Checking system requirements.');
|
||||
|
||||
$doctrineManager = $this->getContainer()->get('doctrine')->getManager();
|
||||
$doctrineManager = $this->getContainer()->get(ManagerRegistry::class)->getManager();
|
||||
|
||||
$rows = [];
|
||||
|
||||
|
@ -95,7 +100,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
$status = '<info>OK!</info>';
|
||||
$help = '';
|
||||
|
||||
$conn = $this->getContainer()->get('doctrine')->getManager()->getConnection();
|
||||
$conn = $this->getContainer()->get(ManagerRegistry::class)->getManager()->getConnection();
|
||||
|
||||
try {
|
||||
$conn->connect();
|
||||
|
@ -244,9 +249,9 @@ class InstallCommand extends ContainerAwareCommand
|
|||
return $this;
|
||||
}
|
||||
|
||||
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$userManager = $this->getContainer()->get('fos_user.user_manager');
|
||||
$userManager = $this->getContainer()->get(UserManagerInterface::class);
|
||||
$user = $userManager->createUser();
|
||||
|
||||
$user->setUsername($this->io->ask('Username', 'wallabag'));
|
||||
|
@ -264,7 +269,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
|
||||
// dispatch a created event so the associated config will be created
|
||||
$event = new UserEvent($user);
|
||||
$this->getContainer()->get('event_dispatcher')->dispatch(FOSUserEvents::USER_CREATED, $event);
|
||||
$this->getContainer()->get(EventDispatcherInterface::class)->dispatch(FOSUserEvents::USER_CREATED, $event);
|
||||
|
||||
$this->io->text('<info>Administration successfully setup.</info>');
|
||||
|
||||
|
@ -274,7 +279,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
protected function setupConfig()
|
||||
{
|
||||
$this->io->section('Step 4 of 4: Config setup.');
|
||||
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
// cleanup before insert new stuff
|
||||
$em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\InternalSetting')->execute();
|
||||
|
@ -329,7 +334,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
|
||||
// PDO does not always close the connection after Doctrine commands.
|
||||
// See https://github.com/symfony/symfony/issues/11750.
|
||||
$this->getContainer()->get('doctrine')->getManager()->getConnection()->close();
|
||||
$this->getContainer()->get(ManagerRegistry::class)->getManager()->getConnection()->close();
|
||||
|
||||
if (0 !== $exitCode) {
|
||||
$this->getApplication()->setAutoExit(true);
|
||||
|
@ -347,7 +352,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
*/
|
||||
private function isDatabasePresent()
|
||||
{
|
||||
$connection = $this->getContainer()->get('doctrine')->getManager()->getConnection();
|
||||
$connection = $this->getContainer()->get(ManagerRegistry::class)->getManager()->getConnection();
|
||||
$databaseName = $connection->getDatabase();
|
||||
|
||||
try {
|
||||
|
@ -368,7 +373,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
|
||||
// custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite
|
||||
if ('sqlite' === $schemaManager->getDatabasePlatform()->getName()) {
|
||||
$params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams();
|
||||
$params = $this->getContainer()->get(Connection::class)->getParams();
|
||||
|
||||
if (isset($params['path']) && file_exists($params['path'])) {
|
||||
return true;
|
||||
|
@ -394,7 +399,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
*/
|
||||
private function isSchemaPresent()
|
||||
{
|
||||
$schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager();
|
||||
$schemaManager = $this->getContainer()->get(ManagerRegistry::class)->getManager()->getConnection()->getSchemaManager();
|
||||
|
||||
return \count($schemaManager->listTableNames()) > 0 ? true : false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue