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

Type cast Ids from String to Integer #14057

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/code/Magento/Customer/Model/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ public function getGroupId()
ScopeInterface::SCOPE_STORE,
$storeId
);
$this->setData('group_id', $groupId);
$this->setData('group_id', (int)$groupId);
}
return $this->getData('group_id');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why haven't you changed added casting from string to int here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not getting you, will you please elaborate?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yogeshks he is talking about the return. The return should be type casted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ferrazzuk
Thanks for the correction, I'll update my commit accordingly.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yogeshks can you move the type casting to the return instead?

}
Expand All @@ -900,7 +900,7 @@ public function getTaxClassId()
{
if (!$this->getData('tax_class_id')) {
$groupTaxClassId = $this->_groupRepository->getById($this->getGroupId())->getTaxClassId();
$this->setData('tax_class_id', $groupTaxClassId);
$this->setData('tax_class_id', (int)$groupTaxClassId);
}
return $this->getData('tax_class_id');
}
Expand Down Expand Up @@ -949,10 +949,10 @@ public function getSharedWebsiteIds()
if ($ids === null) {
$ids = [];
if ((bool)$this->getSharingConfig()->isWebsiteScope()) {
$ids[] = $this->getWebsiteId();
$ids[] = (int)$this->getWebsiteId();
} else {
foreach ($this->_storeManager->getWebsites() as $website) {
$ids[] = $website->getId();
$ids[] = (int)$website->getId();
}
}
$this->setData('shared_website_ids', $ids);
Expand Down