From 5aed9a4924ec65e47d00a294b5d21828f93fe9a6 Mon Sep 17 00:00:00 2001 From: Roman Shopin Date: Thu, 4 Jan 2018 14:53:53 +0000 Subject: [PATCH] CORE-1500: Reverted Gui release, refactored CustomerDependencyProvider and CustomerForm --- composer.json | 2 +- .../Communication/Form/CustomerForm.php | 5 +- .../Customer/CustomerDependencyProvider.php | 104 +++++++++++++----- 3 files changed, 81 insertions(+), 30 deletions(-) diff --git a/composer.json b/composer.json index c5a537ec..0a398d81 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "proprietary", "require": { "spryker/country": "^3.0.0", - "spryker/gui": "^3.13.0", + "spryker/gui": "^3.0.0", "spryker/kernel": "^3.0.0", "spryker/locale": "^3.0.0", "spryker/mail": "^4.0.0", diff --git a/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php b/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php index a4530edc..acdbf603 100644 --- a/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php +++ b/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php @@ -14,6 +14,7 @@ use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\DateType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Callback; @@ -227,7 +228,7 @@ protected function addCompanyField(FormBuilderInterface $builder) new Length(['max' => 100]), ]; - $builder->add(static::FIELD_COMPANY, 'text', [ + $builder->add(static::FIELD_COMPANY, TextType::class, [ 'label' => 'Company', 'required' => false, 'constraints' => $companyConstraints, @@ -247,7 +248,7 @@ protected function addPhoneField(FormBuilderInterface $builder) new Length(['max' => 255]), ]; - $builder->add(static::FIELD_PHONE, 'text', [ + $builder->add(static::FIELD_PHONE, TextType::class, [ 'label' => 'Phone', 'required' => false, 'constraints' => $phoneConstraints, diff --git a/src/Spryker/Zed/Customer/CustomerDependencyProvider.php b/src/Spryker/Zed/Customer/CustomerDependencyProvider.php index 8ec3aa44..7b8d6d7c 100644 --- a/src/Spryker/Zed/Customer/CustomerDependencyProvider.php +++ b/src/Spryker/Zed/Customer/CustomerDependencyProvider.php @@ -42,29 +42,14 @@ class CustomerDependencyProvider extends AbstractBundleDependencyProvider */ public function provideBusinessLayerDependencies(Container $container) { - $container[static::FACADE_SEQUENCE_NUMBER] = function (Container $container) { - return new CustomerToSequenceNumberBridge($container->getLocator()->sequenceNumber()->facade()); - }; - - $container[static::FACADE_COUNTRY] = function (Container $container) { - return new CustomerToCountryBridge($container->getLocator()->country()->facade()); - }; - - $container[static::FACADE_LOCALE] = function (Container $container) { - return new CustomerToLocaleBridge($container->getLocator()->locale()->facade()); - }; - - $container[static::FACADE_MAIL] = function (Container $container) { - return new CustomerToMailBridge($container->getLocator()->mail()->facade()); - }; - - $container[static::QUERY_CONTAINER_LOCALE] = function (Container $container) { - return $container->getLocator()->locale()->queryContainer(); - }; - + $container = $this->addSequenceNumberFacade($container); + $container = $this->addCountryFacade($container); + $container = $this->addMailFacade($container); + $container = $this->addLocaleQueryConainer($container); $container = $this->addStore($container); $container = $this->addCustomerAnonymizerPlugins($container); $container = $this->addUtilValidateService($container); + $container = $this->addLocaleFacade($container); return $container; } @@ -76,13 +61,8 @@ public function provideBusinessLayerDependencies(Container $container) */ public function provideCommunicationLayerDependencies(Container $container) { - $container[static::FACADE_COUNTRY] = function (Container $container) { - return new CustomerToCountryBridge($container->getLocator()->country()->facade()); - }; - $container[self::SERVICE_DATE_FORMATTER] = function (Container $container) { - return $container->getLocator()->utilDateTime()->service(); - }; - + $container = $this->addCountryFacade($container); + $container = $this->addDateFormatterService($container); $container = $this->addStore($container); $container = $this->addCustomerTransferExpanderPlugins($container); $container = $this->addUtilSanitizeService($container); @@ -190,4 +170,74 @@ protected function addLocaleFacade(Container $container) return $container; } + + /** + * @param \Spryker\Zed\Kernel\Container $container + * + * @return \Spryker\Zed\Kernel\Container + */ + protected function addSequenceNumberFacade(Container $container): \Spryker\Zed\Kernel\Container + { + $container[static::FACADE_SEQUENCE_NUMBER] = function (Container $container) { + return new CustomerToSequenceNumberBridge($container->getLocator()->sequenceNumber()->facade()); + }; + + return $container; + } + + /** + * @param \Spryker\Zed\Kernel\Container $container + * + * @return \Spryker\Zed\Kernel\Container + */ + protected function addCountryFacade(Container $container): \Spryker\Zed\Kernel\Container + { + $container[static::FACADE_COUNTRY] = function (Container $container) { + return new CustomerToCountryBridge($container->getLocator()->country()->facade()); + }; + + return $container; + } + + /** + * @param \Spryker\Zed\Kernel\Container $container + * + * @return \Spryker\Zed\Kernel\Container + */ + protected function addMailFacade(Container $container): \Spryker\Zed\Kernel\Container + { + $container[static::FACADE_MAIL] = function (Container $container) { + return new CustomerToMailBridge($container->getLocator()->mail()->facade()); + }; + + return $container; + } + + /** + * @param \Spryker\Zed\Kernel\Container $container + * + * @return \Spryker\Zed\Kernel\Container + */ + protected function addLocaleQueryConainer(Container $container): \Spryker\Zed\Kernel\Container + { + $container[static::QUERY_CONTAINER_LOCALE] = function (Container $container) { + return $container->getLocator()->locale()->queryContainer(); + }; + + return $container; + } + + /** + * @param \Spryker\Zed\Kernel\Container $container + * + * @return \Spryker\Zed\Kernel\Container + */ + protected function addDateFormatterService(Container $container): \Spryker\Zed\Kernel\Container + { + $container[static::SERVICE_DATE_FORMATTER] = function (Container $container) { + return $container->getLocator()->utilDateTime()->service(); + }; + + return $container; + } }