Skip to content

Commit

Permalink
CORE-1500: Reverted Gui release, refactored CustomerDependencyProvide…
Browse files Browse the repository at this point in the history
…r and CustomerForm
  • Loading branch information
devromans committed Jan 4, 2018
1 parent 45c63b1 commit 5aed9a4
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 30 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
104 changes: 77 additions & 27 deletions src/Spryker/Zed/Customer/CustomerDependencyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 5aed9a4

Please sign in to comment.