From 35f5f4851e25430e3be4a64ab48591c4049414d6 Mon Sep 17 00:00:00 2001
From: Alejandro Celaya <alejandro@alejandrocelaya.com>
Date: Mon, 23 Dec 2019 10:38:06 +0100
Subject: [PATCH 1/3] Moved class alias to container.php to avoid it from being
 lost after configuration is cached

---
 config/autoload/locks.global.php | 1 -
 config/container.php             | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/config/autoload/locks.global.php b/config/autoload/locks.global.php
index db64e187..54d6ae66 100644
--- a/config/autoload/locks.global.php
+++ b/config/autoload/locks.global.php
@@ -10,7 +10,6 @@ use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
 
 // This class alias tricks the ConfigAbstractFactory to return Lock\Factory instances even with a different service name
 $localLockFactory = 'Shlinkio\Shlink\LocalLockFactory';
-class_alias(Lock\Factory::class, $localLockFactory);
 
 return [
 
diff --git a/config/container.php b/config/container.php
index 37be5669..7bcc6181 100644
--- a/config/container.php
+++ b/config/container.php
@@ -3,6 +3,7 @@
 declare(strict_types=1);
 
 use Symfony\Component\Dotenv\Dotenv;
+use Symfony\Component\Lock;
 use Zend\ServiceManager\ServiceManager;
 
 chdir(dirname(__DIR__));
@@ -18,6 +19,7 @@ if (class_exists(Dotenv::class)) {
 }
 
 // Build container
+class_alias(Lock\Factory::class, 'Shlinkio\Shlink\LocalLockFactory');
 $config = require __DIR__ . '/config.php';
 $container = new ServiceManager($config['dependencies']);
 $container->setService('config', $config);

From 6de0cba0b0c5c32b05eb6e609df772d96cc45d49 Mon Sep 17 00:00:00 2001
From: Alejandro Celaya <alejandro@alejandrocelaya.com>
Date: Mon, 23 Dec 2019 10:50:03 +0100
Subject: [PATCH 2/3] Updated changelog

---
 CHANGELOG.md | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c28aa0af..123d0ff4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
 
+## 1.20.3 - 2019-12-23
+
+#### Added
+
+* *Nothing*
+
+#### Changed
+
+* *Nothing*
+
+#### Deprecated
+
+* *Nothing*
+
+#### Removed
+
+* *Nothing*
+
+#### Fixed
+
+* [#585](https://github.com/shlinkio/shlink/issues/585) Fixed `PHP Fatal error: Uncaught Error: Class 'Shlinkio\Shlink\LocalLockFactory' not found` happening when running some CLI commands.
+
+
 ## 1.20.2 - 2019-12-06
 
 #### Added

From 363423621416637545c4964ef98e16da0c156fcf Mon Sep 17 00:00:00 2001
From: Alejandro Celaya <alejandro@alejandrocelaya.com>
Date: Mon, 23 Dec 2019 11:00:38 +0100
Subject: [PATCH 3/3] Fixed some comments

---
 config/autoload/locks.global.php | 1 -
 config/container.php             | 4 +++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/config/autoload/locks.global.php b/config/autoload/locks.global.php
index 54d6ae66..8462e15b 100644
--- a/config/autoload/locks.global.php
+++ b/config/autoload/locks.global.php
@@ -8,7 +8,6 @@ use Shlinkio\Shlink\Common\Logger\LoggerAwareDelegatorFactory;
 use Symfony\Component\Lock;
 use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
 
-// This class alias tricks the ConfigAbstractFactory to return Lock\Factory instances even with a different service name
 $localLockFactory = 'Shlinkio\Shlink\LocalLockFactory';
 
 return [
diff --git a/config/container.php b/config/container.php
index 7bcc6181..d33149a3 100644
--- a/config/container.php
+++ b/config/container.php
@@ -18,8 +18,10 @@ if (class_exists(Dotenv::class)) {
     $dotenv->load(__DIR__ . '/../.env');
 }
 
-// Build container
+// This class alias tricks the ConfigAbstractFactory to return Lock\Factory instances even with a different service name
 class_alias(Lock\Factory::class, 'Shlinkio\Shlink\LocalLockFactory');
+
+// Build container
 $config = require __DIR__ . '/config.php';
 $container = new ServiceManager($config['dependencies']);
 $container->setService('config', $config);