]> git.andy128k.dev Git - ipf.git/commitdiff
fix createsuperuser command
authorAndrey Kutejko <andy128k@gmail.com>
Fri, 26 Apr 2019 15:19:28 +0000 (17:19 +0200)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 4 May 2019 09:19:30 +0000 (11:19 +0200)
ipf/auth/app.php
ipf/auth/commands/createsuperuser.php

index eeb28b9220c74f12390bf15295c392568b1cba54..02dcea80e55d057c8b07e90d66e4d1ef873f567b 100644 (file)
@@ -87,7 +87,7 @@ class IPF_Auth_App extends IPF_Application
     public function commands()
     {
         return array(
-            new \IPF\Auth\Commands\CreateSuperUser($this, $this->container['auth_service']),
+            new \IPF\Auth\Commands\CreateSuperUser($this, $this->container['auth_service'], $this->getConnection()),
         );
     }
 
index 2722a71259adc4098eb7fdca766e79f6f19e9d12..7cd914d00d421542018663bdbd7aaff556310a25 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace IPF\Auth\Commands;
 
+use Doctrine\DBAL\Connection;
 use IPF\Auth\AuthService;
 
 class CreateSuperUser
@@ -13,11 +14,14 @@ class CreateSuperUser
     private $auth_app;
     /** @var AuthService */
     private $auth_service;
+    /** @var Connection */
+    private $connection;
 
-    public function __construct(\IPF_Auth_App $auth_app, AuthService $auth_service)
+    public function __construct(\IPF_Auth_App $auth_app, AuthService $auth_service, Connection $connection)
     {
         $this->auth_app = $auth_app;
         $this->auth_service = $auth_service;
+        $this->connection = $connection;
     }
 
     public function run($args=null)
@@ -35,7 +39,7 @@ class CreateSuperUser
         $su->is_active    = true;
         $su->is_superuser = true;
         $this->auth_service->setPassword($su, $password);
-        $su->save();
+        $su->save($this->connection);
         print "Done\n";
     }
 }