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

M2.2.5 : CustomerRepository::getList() does not load custom attribute if the name is "company" #17759

Closed
kanduvisla opened this issue Aug 23, 2018 · 10 comments
Assignees
Labels
Component: Customer Event: mageconf Event: mm18mx Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release up for grabs

Comments

@kanduvisla
Copy link
Contributor

kanduvisla commented Aug 23, 2018

I have custom EAV attributes named "company" for customers, but this is not loaded if I use the CustomerRepository::getList()-method. Other custom attributes seem to be loaded properly.

Preconditions

  1. Magento 2.2.5

Steps to reproduce

  1. Create customer EAV attribute named "company" (varchar)
  2. Populate it with some data
  3. Load it with CustomerRepository::get() / getById()
  4. Load it with CustomerRepository::getList()

Expected result

In both the situations, $customer->getCustomAttribute('company')->getValue() should return the value defined for this attribute.

Actual result

The get() / getById()-method loads the proper value, getList() returns NULL.

Possible cause

My best guess is that it has something to do with the fact that getList() joins the customer address that also has a company-column:

$collection->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
    ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
    ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
    ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
    ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left')
    ->joinAttribute('company', 'customer_address/company', 'default_billing', null, 'left');

Possible solution

I can think of 2 solutions:

  • Throw an exception that company (or whatever other joined attributed) is a reserved keyword.
  • Allow the customer model to override the address attributes (order of loading)

Workaround

I currently have to do the following workaround (in my situation, my search criteria always returns 1 customer):

$customers = $customerSearchResult->getItems();
return $this->customerRepository->getById($customers[0]->getId());
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Aug 23, 2018
@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Aug 23, 2018

Hi @kanduvisla. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me {$VERSION} instance

where {$VERSION} is version tags (starting from 2.2.0+) or develop branches (2.2-develop +).
For more details, please, review the Magento Contributor Assistant documentation.

@kanduvisla do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@ghost ghost self-assigned this Aug 23, 2018
@ghost
Copy link

ghost commented Aug 23, 2018

@kanduvisla, thank you for your report.
We've acknowledged the issue and added to our backlog.

@ghost ghost added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Component: Customer Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Aug 23, 2018
@ghost ghost removed their assignment Aug 23, 2018
@AlexandrKozyr AlexandrKozyr self-assigned this Sep 8, 2018
@irving0mar
Copy link

#mm18mx

@magento-engcom-team
Copy link
Contributor

@irving0mar thank you for joining. Please accept team invitation here and self-assign the issue.

@magento-engcom-team
Copy link
Contributor

Hi @irving0mar. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

@nik4152
Copy link

nik4152 commented Nov 2, 2018

#mageconf

@magento-engcom-team
Copy link
Contributor

@nik4152 thank you for joining. Please accept team invitation here and self-assign the issue.

@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Nov 2, 2018

Hi @nik4152. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

nik4152 added a commit to nik4152/magento2 that referenced this issue Nov 2, 2018
fix select get list from repository customer customer field company
nik4152 added a commit to nik4152/magento2 that referenced this issue Nov 2, 2018
fix test get list from customer repository
teganbold added a commit to teganbold/magento2 that referenced this issue Dec 7, 2018
As specified in issue magento#17759, CustomerRepository::getList() is
unexpectedly returning NULL, when CustomerRepository::get() is correctly
returning the value. Specifying the attribute as billing_company instead
of company removes the conflict.
@sidolov
Copy link
Contributor

sidolov commented Jan 4, 2019

Hi @kanduvisla. Thank you for your report.
The issue has been fixed in #19620 by @MiliTree in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.1 release.

@sidolov sidolov added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Jan 4, 2019
@sidolov sidolov closed this as completed Jan 4, 2019
@magento-engcom-team
Copy link
Contributor

Hi @kanduvisla. Thank you for your report.
The issue has been fixed in #20284 by @GovindaSharma in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.8 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Customer Event: mageconf Event: mm18mx Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release up for grabs
Projects
None yet
Development

No branches or pull requests

6 participants