Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customer::Gender is required but might be empty if removed from form #8493

Closed
kochen opened this issue Sep 4, 2017 · 5 comments
Closed

Customer::Gender is required but might be empty if removed from form #8493

kochen opened this issue Sep 4, 2017 · 5 comments
Labels
Potential Bug Potential bugs or bugfixes, that needs to be reproduced.

Comments

@kochen
Copy link
Contributor

kochen commented Sep 4, 2017

Customer::Gender is a required field:

            <options>
                <option name="default">u</option>
            </options>
        </field>

which has a default value u.

but when being removed (i.e not needed for the shop) from .../vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/views/Account/profileUpdate.html.twig:
<div class="field">{{ form_row(form.gender) }}</div>
you get an error saying:
image

This issue seem to occur as well from the API - @psihius could you confirm/elaborate?

kochen pushed a commit to kochen/Sylius that referenced this issue Sep 4, 2017
@pjedrzejewski pjedrzejewski added the Potential Bug Potential bugs or bugfixes, that needs to be reproduced. label Sep 5, 2017
@pjedrzejewski pjedrzejewski modified the milestones: v1.0.0, v1.1.0 Sep 11, 2017
@pjedrzejewski
Copy link
Member

@kochen this behavior is actually correct. If you remove this field from template, you should also remove it from the form. (using form type extension)

@kochen
Copy link
Contributor Author

kochen commented Sep 12, 2017

@pjedrzejewski that's true, but it'd also require you to remove the attribute from the DB.
what I'm trying to do here is properly set the default value of u for the case where not value is provided.

@pjedrzejewski
Copy link
Member

@kochen but this should happen on the Customer object already in the constructor here:

protected $gender = CustomerInterface::UNKNOWN_GENDER;

@kochen
Copy link
Contributor Author

kochen commented Sep 12, 2017

@pjedrzejewski yes, but it doesn't happen :)

@itinance
Copy link
Contributor

itinance commented Aug 30, 2018

I don't know why this issue was closed although the provided PR is still unmerged.

However, i've found the following fixes:

a) write an own GenderType according to the draft of @kochen (https://github.com/kochen/Sylius/blob/36099fbbc6f70484595b1e0a082031b548fafc6b/src/Sylius/Bundle/CustomerBundle/Form/Type/GenderType.php#L37)

b) override the "gender"-type like this:

->add('gender', HiddenType::class, array(
                'data' => CustomerInterface::UNKNOWN_GENDER,
            ))

pamil pushed a commit to kochen/Sylius that referenced this issue Oct 2, 2018
pamil added a commit that referenced this issue Oct 3, 2018
set gender `u` as default value - resolves #8493
pamil added a commit that referenced this issue Oct 3, 2018
* 1.1:
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves #8493
  [Order] Fixed sylius:remove-expired-carts help
  Make ArrayGridProvider more performant & suitable for PHP-PM
  [Documentation] Fix API example for creating a taxon
pamil added a commit that referenced this issue Oct 3, 2018
* 1.2:
  Apply coding standard fixes
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves #8493
  [ThemeBundle] Fix risky tests
  [Order] Fixed sylius:remove-expired-carts help
  remove shared storage call to save password reset token
  Make ArrayGridProvider more performant & suitable for PHP-PM
  Update gulpfile.babel.js
  [Documentation] Fix API example for creating a taxon
  few changes after code review
  [Behat] add Changing my account password with token I received scenario
pamil added a commit that referenced this issue Oct 3, 2018
* 1.3: (22 commits)
  Apply coding standard fixes
  Apply coding standard fixes
  Apply coding standard fixes
  Update Composer's branch-alias for 1.3
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves #8493
  [ThemeBundle] Fix risky tests
  [Order] Fixed sylius:remove-expired-carts help
  remove shared storage call to save password reset token
  Make ArrayGridProvider more performant & suitable for PHP-PM
  Update gulpfile.babel.js
  [Documentation] Fix API example for creating a taxon
  ...
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.1:
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [Order] Fixed sylius:remove-expired-carts help
  Make ArrayGridProvider more performant & suitable for PHP-PM
  [Documentation] Fix API example for creating a taxon
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.2:
  Apply coding standard fixes
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [ThemeBundle] Fix risky tests
  [Order] Fixed sylius:remove-expired-carts help
  remove shared storage call to save password reset token
  Make ArrayGridProvider more performant & suitable for PHP-PM
  Update gulpfile.babel.js
  [Documentation] Fix API example for creating a taxon
  few changes after code review
  [Behat] add Changing my account password with token I received scenario
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.1:
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [Order] Fixed sylius:remove-expired-carts help
  Make ArrayGridProvider more performant & suitable for PHP-PM
  [Documentation] Fix API example for creating a taxon
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.2:
  Apply coding standard fixes
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [ThemeBundle] Fix risky tests
  [Order] Fixed sylius:remove-expired-carts help
  remove shared storage call to save password reset token
  Make ArrayGridProvider more performant & suitable for PHP-PM
  Update gulpfile.babel.js
  [Documentation] Fix API example for creating a taxon
  few changes after code review
  [Behat] add Changing my account password with token I received scenario
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.3: (22 commits)
  Apply coding standard fixes
  Apply coding standard fixes
  Apply coding standard fixes
  Update Composer's branch-alias for 1.3
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [ThemeBundle] Fix risky tests
  [Order] Fixed sylius:remove-expired-carts help
  remove shared storage call to save password reset token
  Make ArrayGridProvider more performant & suitable for PHP-PM
  Update gulpfile.babel.js
  [Documentation] Fix API example for creating a taxon
  ...
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.1:
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [Order] Fixed sylius:remove-expired-carts help
  Make ArrayGridProvider more performant & suitable for PHP-PM
  [Documentation] Fix API example for creating a taxon
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.2:
  Apply coding standard fixes
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [ThemeBundle] Fix risky tests
  [Order] Fixed sylius:remove-expired-carts help
  remove shared storage call to save password reset token
  Make ArrayGridProvider more performant & suitable for PHP-PM
  Update gulpfile.babel.js
  [Documentation] Fix API example for creating a taxon
  few changes after code review
  [Behat] add Changing my account password with token I received scenario
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.1:
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [Order] Fixed sylius:remove-expired-carts help
  Make ArrayGridProvider more performant & suitable for PHP-PM
  [Documentation] Fix API example for creating a taxon
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.2:
  Apply coding standard fixes
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [ThemeBundle] Fix risky tests
  [Order] Fixed sylius:remove-expired-carts help
  remove shared storage call to save password reset token
  Make ArrayGridProvider more performant & suitable for PHP-PM
  Update gulpfile.babel.js
  [Documentation] Fix API example for creating a taxon
  few changes after code review
  [Behat] add Changing my account password with token I received scenario
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.1:
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [Order] Fixed sylius:remove-expired-carts help
  Make ArrayGridProvider more performant & suitable for PHP-PM
  [Documentation] Fix API example for creating a taxon
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.2:
  Apply coding standard fixes
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [ThemeBundle] Fix risky tests
  [Order] Fixed sylius:remove-expired-carts help
  remove shared storage call to save password reset token
  Make ArrayGridProvider more performant & suitable for PHP-PM
  Update gulpfile.babel.js
  [Documentation] Fix API example for creating a taxon
  few changes after code review
  [Behat] add Changing my account password with token I received scenario
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.1:
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [Order] Fixed sylius:remove-expired-carts help
  Make ArrayGridProvider more performant & suitable for PHP-PM
  [Documentation] Fix API example for creating a taxon
pamil added a commit to pamil/Sylius that referenced this issue May 7, 2019
* 1.2:
  Apply coding standard fixes
  Apply coding standard fixes
  Update "Configuring taxation" docs
  [GridBundle] Do not put unnecessary "andWhere" in ExpressionBuilder
  [Grid] Fix getting enabled grid items
  [ThemeBundle] Replace "symfony/symfony" dependency with specific Symfony packages
  Keep the existing pagination when changing sorting on product list page
  Fix API validation tests
  [ShippingBundle] Add validation for ShippingMethod calculator
  Narrow down selectors to prevent unexpected bugs
  [CoreBundle] Make sure promotion action/rule amount is an integer
  set gender `u` as default value - resolves Sylius#8493
  [ThemeBundle] Fix risky tests
  [Order] Fixed sylius:remove-expired-carts help
  remove shared storage call to save password reset token
  Make ArrayGridProvider more performant & suitable for PHP-PM
  Update gulpfile.babel.js
  [Documentation] Fix API example for creating a taxon
  few changes after code review
  [Behat] add Changing my account password with token I received scenario
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
Development

No branches or pull requests

3 participants