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

Use repository to load order when manually creating an invoice #19727

Merged
merged 2 commits into from
Mar 26, 2019

Conversation

JeroenVanLeusden
Copy link
Member

Description (*)

Use repository to load order when manually creating an invoice. This way extension attributes are set and can be used later in the flow (e.g. observers).

Fixed Issues (if relevant)

  1. None I could find.

Manual testing scenarios (*)

  1. Create extension attribute on Order entity.
  2. Place order and manually capture the invoice.
  3. Order + extension attributes should be loaded but they're not.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @JeroenVanLeusden. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

*/
public function __construct(
Action\Context $context,
Registry $registry,
PageFactory $resultPageFactory,
InvoiceService $invoiceService
InvoiceService $invoiceService,
OrderRepositoryInterface $orderRepository
Copy link
Contributor

Choose a reason for hiding this comment

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

$this->invoiceService = $invoiceService;
$this->orderRepository = $orderRepository;

parent::__construct($context);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please call parent constructor first whenever possible.

@JeroenVanLeusden
Copy link
Member Author

@orlangur Updated the PR.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.1 milestone Dec 12, 2018
@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-3679 has been created to process this Pull Request


try {
/** @var \Magento\Sales\Model\Order $order */
$order = $this->_objectManager->create(\Magento\Sales\Model\Order::class)->load($orderId);
$order = $this->orderRepository->get($orderId);
if (!$order->getId()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This check doesn't make sense anymore because orderRepository will throw an exception in case when order does not exist.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sidolov I've removed the check.

ENGCOM-3679: Static test fix.
ENGCOM-3679: Unit test fix.
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-3679 has been created to process this Pull Request

@okorshenko okorshenko removed this from the Release: 2.3.1 milestone Jan 28, 2019
@p-bystritsky p-bystritsky self-assigned this Mar 18, 2019
@sivaschenko
Copy link
Member

@kandy can you please approve the performance degradation introduced by this PR:

Invoice Start (Admin Returns Management) - Another one: 35.6% (mainline = 45 | team = 61) -> DEGRADATION

@sivaschenko sivaschenko requested a review from kandy March 21, 2019 16:59
@kandy
Copy link
Contributor

kandy commented Mar 21, 2019

@sivaschenko Degradation on Invoice Start Scenario is approved

@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-3679 has been created to process this Pull Request

@ghost ghost added the Progress: accept label Mar 22, 2019
@magento-engcom-team magento-engcom-team merged commit 981a824 into magento:2.3-develop Mar 26, 2019
@ghost
Copy link

ghost commented Mar 26, 2019

Hi @JeroenVanLeusden, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants