From 2263d5c9de4e459d864b9623eb02c3f93b7b331f Mon Sep 17 00:00:00 2001
From: Sergii Kovalenko <skovalenko@magento.com>
Date: Fri, 11 Nov 2016 13:39:05 +0200
Subject: [PATCH] MAGETWO-56989: Deployment process can't be executed on
 separate machine

-move deploy static command
---
 .../Eav/Model/Entity/AttributeCache.php       | 26 ++--------------
 .../Theme/Model/Theme/ThemeProvider.php       | 30 +++----------------
 .../Magento/User/Model/ResourceModel/User.php | 23 --------------
 3 files changed, 6 insertions(+), 73 deletions(-)

diff --git a/app/code/Magento/Eav/Model/Entity/AttributeCache.php b/app/code/Magento/Eav/Model/Entity/AttributeCache.php
index 2aca4aa5896..f4f52e154cd 100644
--- a/app/code/Magento/Eav/Model/Entity/AttributeCache.php
+++ b/app/code/Magento/Eav/Model/Entity/AttributeCache.php
@@ -9,8 +9,6 @@ namespace Magento\Eav\Model\Entity;
 use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
 use Magento\Framework\App\CacheInterface;
 use Magento\Framework\App\Cache\StateInterface;
-use Magento\Framework\App\ObjectManager;
-use Magento\Framework\Serialize\Serializer\Serialize;
 use Magento\Framework\Serialize\SerializerInterface;
 
 /**
@@ -46,11 +44,6 @@ class AttributeCache
      */
     private $unsupportedTypes;
 
-    /**
-     * @var SerializerInterface
-     */
-    private $serializer;
-
     /**
      * AttributeCache constructor.
      * @param CacheInterface $cache
@@ -97,7 +90,7 @@ class AttributeCache
             $cacheKey = self::ATTRIBUTES_CACHE_PREFIX . $entityType . $suffix;
             $attributesData = $this->cache->load($cacheKey);
             if ($attributesData) {
-                $attributes = $this->getSerializer()->unserialize($attributesData);
+                $attributes = unserialize($attributesData);
                 $this->attributeInstances[$entityType . $suffix] = $attributes;
                 return $attributes;
             }
@@ -121,7 +114,7 @@ class AttributeCache
         $this->attributeInstances[$entityType . $suffix] = $attributes;
         if ($this->isAttributeCacheEnabled()) {
             $cacheKey = self::ATTRIBUTES_CACHE_PREFIX . $entityType . $suffix;
-            $attributesData = $this->getSerializer()->serialize($attributes);
+            $attributesData = serialize($attributes);
             $this->cache->save(
                 $attributesData,
                 $cacheKey,
@@ -153,19 +146,4 @@ class AttributeCache
         }
         return true;
     }
-
-    /**
-     * Retrieve handler which allows serialize/deserialize data
-     *
-     * @deprecated
-     * @return SerializerInterface
-     */
-    private function getSerializer()
-    {
-        if (!$this->serializer) {
-            $this->serializer = ObjectManager::getInstance()->get(Serialize::class);
-        }
-
-        return $this->serializer;
-    }
 }
diff --git a/app/code/Magento/Theme/Model/Theme/ThemeProvider.php b/app/code/Magento/Theme/Model/Theme/ThemeProvider.php
index 68e675387f9..89d7bfc18d3 100644
--- a/app/code/Magento/Theme/Model/Theme/ThemeProvider.php
+++ b/app/code/Magento/Theme/Model/Theme/ThemeProvider.php
@@ -6,8 +6,6 @@
 namespace Magento\Theme\Model\Theme;
 
 use Magento\Framework\App\ObjectManager;
-use Magento\Framework\Serialize\Serializer\Serialize;
-use Magento\Framework\Serialize\SerializerInterface;
 use Magento\Framework\View\Design\Theme\ListInterface;
 use Magento\Framework\App\DeploymentConfig;
 
@@ -46,11 +44,6 @@ class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProvide
      */
     private $deploymentConfig;
 
-    /**
-     * @var SerializerInterface
-     */
-    private $serializer;
-
     /**
      * ThemeProvider constructor.
      *
@@ -84,13 +77,13 @@ class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProvide
         /** @var $themeCollection \Magento\Theme\Model\ResourceModel\Theme\Collection */
         $theme = $this->cache->load('theme'. $fullPath);
         if ($theme) {
-            $this->themes[$fullPath] = $this->getSerializer()->unserialize($theme);
+            $this->themes[$fullPath] = unserialize($theme);
             return $this->themes[$fullPath];
         }
         $themeCollection = $this->collectionFactory->create();
         $item = $themeCollection->getThemeByFullPath($fullPath);
         if ($item->getId()) {
-            $themeData = $this->getSerializer()->serialize($item);
+            $themeData = serialize($item);
             $this->cache->save($themeData, 'theme' . $fullPath);
             $this->cache->save($themeData, 'theme-by-id-' . $item->getId());
             $this->themes[$fullPath] = $item;
@@ -122,14 +115,14 @@ class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProvide
         }
         $theme = $this->cache->load('theme-by-id-' . $themeId);
         if ($theme) {
-            $this->themes[$themeId] = $this->getSerializer()->unserialize($theme);
+            $this->themes[$themeId] = unserialize($theme);
             return $this->themes[$themeId];
         }
         /** @var $themeModel \Magento\Framework\View\Design\ThemeInterface */
         $themeModel = $this->themeFactory->create();
         $themeModel->load($themeId);
         if ($themeModel->getId()) {
-            $this->cache->save($this->getSerializer()->serialize($themeModel), 'theme-by-id-' . $themeId);
+            $this->cache->save(serialize($themeModel), 'theme-by-id-' . $themeId);
             $this->themes[$themeId] = $themeModel;
         }
         return $themeModel;
@@ -158,19 +151,4 @@ class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProvide
         }
         return $this->deploymentConfig;
     }
-
-    /**
-     * Retrieve handler which allows serialize/deserialize data
-     *
-     * @deprecated
-     * @return SerializerInterface
-     */
-    private function getSerializer()
-    {
-        if (!$this->serializer) {
-            $this->serializer = ObjectManager::getInstance()->get(Serialize::class);
-        }
-
-        return $this->serializer;
-    }
 }
diff --git a/app/code/Magento/User/Model/ResourceModel/User.php b/app/code/Magento/User/Model/ResourceModel/User.php
index fee2a07b21c..d3e228d4435 100644
--- a/app/code/Magento/User/Model/ResourceModel/User.php
+++ b/app/code/Magento/User/Model/ResourceModel/User.php
@@ -9,9 +9,6 @@ namespace Magento\User\Model\ResourceModel;
 use Magento\Authorization\Model\Acl\Role\Group as RoleGroup;
 use Magento\Authorization\Model\Acl\Role\User as RoleUser;
 use Magento\Authorization\Model\UserContextInterface;
-use Magento\Framework\App\ObjectManager;
-use Magento\Framework\Serialize\Serializer\Serialize;
-use Magento\Framework\Serialize\SerializerInterface;
 use Magento\User\Model\User as ModelUser;
 
 /**
@@ -37,11 +34,6 @@ class User extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
      */
     protected $dateTime;
 
-    /**
-     * @var SerializerInterface
-     */
-    private $serializer;
-
     /**
      * Construct
      *
@@ -625,19 +617,4 @@ class User extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
             [':user_id' => $userId]
         );
     }
-
-    /**
-     * Retrieve handler which allows serialize/deserialize data
-     *
-     * @deprecated
-     * @return SerializerInterface
-     */
-    private function getSerializer()
-    {
-        if (!$this->serializer) {
-            $this->serializer = ObjectManager::getInstance()->get(Serialize::class);
-        }
-
-        return $this->serializer;
-    }
 }
-- 
GitLab