Skip to content

Commit

Permalink
Merge pull request #49 from BitBagCommerce/OPSRC-454/SyliusBlacklistP…
Browse files Browse the repository at this point in the history
…lugin-fixing_adding_a_new_one_Blacklist_Rule

add new parameter to constructor in form with customer group
  • Loading branch information
KrisFlorq authored Jan 10, 2022
2 parents 2392bbe + c037998 commit 4552ee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Form/Type/BlacklistingRuleType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ final class BlacklistingRuleType extends AbstractResourceType
/** @var array */
private $attributeChoices;

public function __construct(string $dataClass, array $attributeChoices, array $validationGroups = [])
{
/* @var string */
private $customerGroupClass;

public function __construct(
string $dataClass,
array $attributeChoices,
string $customerGroupClass,
array $validationGroups = []
) {
parent::__construct($dataClass, $validationGroups);

$this->attributeChoices = $attributeChoices;
$this->customerGroupClass = $customerGroupClass;
}

public function buildForm(FormBuilderInterface $builder, array $options): void
Expand All @@ -54,7 +62,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'label' => 'bitbag_sylius_blacklist_plugin.form.blacklisting_rule.channels',
])
->add('customerGroups', EntityType::class, [
'class' => CustomerGroup::class,
'class' => $this->customerGroupClass,
'multiple' => true,
'expanded' => true,
'label' => 'bitbag_sylius_blacklist_plugin.form.blacklisting_rule.customer_group',
Expand Down
1 change: 1 addition & 0 deletions src/Resources/config/services/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<service id="bitbag.sylius_blacklist_plugin.form.type.blacklisting_rule" class="BitBag\SyliusBlacklistPlugin\Form\Type\BlacklistingRuleType">
<argument>%bitbag_sylius_blacklist_plugin.model.blacklisting_rule.class%</argument>
<argument>%bitbag_sylius_blacklist_plugin.blacklisting_rule_attribute_choices%</argument>
<argument type="string">%sylius.model.customer_group.class%</argument>
<argument>%bitbag.sylius_blacklist_plugin.form.type.validation_groups%</argument>
<tag name="form.type"/>
</service>
Expand Down

0 comments on commit 4552ee2

Please sign in to comment.