From: Andrey Kutejko Date: Fri, 26 Apr 2019 15:19:28 +0000 (+0200) Subject: fix createsuperuser command X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=b3165d09708fe82f14da89c676e40c29964875fc;p=ipf.git fix createsuperuser command --- diff --git a/ipf/auth/app.php b/ipf/auth/app.php index eeb28b9..02dcea8 100644 --- a/ipf/auth/app.php +++ b/ipf/auth/app.php @@ -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()), ); } diff --git a/ipf/auth/commands/createsuperuser.php b/ipf/auth/commands/createsuperuser.php index 2722a71..7cd914d 100644 --- a/ipf/auth/commands/createsuperuser.php +++ b/ipf/auth/commands/createsuperuser.php @@ -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"; } }