-
Notifications
You must be signed in to change notification settings - Fork 248
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
Task 290 import export source code #307
Merged
Merged
Changes from 4 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
8548525
MSI: issue #290
273860e
Merge remote-tracking branch 'origin/task-288-add-source-code' into t…
32c1a3e
MSI: issue #290
ad090a0
MSI: issue #290
81fc718
MSI: issue #290
deadlexus 6cdfe6e
MSI: issue #290
deadlexus fcc8334
Merge branch 'develop' into task-290-import-export-source-code
maghamed 1b85ca7
MSI: issue #290
fb9480d
MSI: issue #290
deadlexus c070521
MSI: issue #290
deadlexus bb971db
MSI: issue #290
deadlexus 8461023
MSI: issue #290
deadlexus 8cf6711
Merge remote-tracking branch 'origin/develop' into task-290-import-ex…
deadlexus 044bc6f
MSI: issue #290
deadlexus ac3175b
MSI: issue #290
deadlexus 9e92360
Merge remote-tracking branch 'origin/develop' into task-290-import-ex…
deadlexus b7af836
MSI: issue #290
deadlexus e506891
MSI: issue #290
deadlexus 988655a
MSI: issue #290
deadlexus 7bbd6a5
MSI: issue #290
94ae490
Merge branch 'develop' into task-290-import-export-source-code
maghamed cfb2611
Adapt SourceCodes with PreventAssignSourcesToDefaultStockPlugin logic
maghamed 622438b
Adapt SourceCodes with PreventAssignSourcesToDefaultStockPlugin logic
maghamed f425473
Fixed Sample File for Inventory Import
maghamed f819625
MSI: issue #290
3dfe677
Merge branch 'task-290-import-export-source-code' of https://github.c…
de53a75
Fix conflicts with develop
maghamed 5e7fcae
Make Indexers to use SourceId instead of SourceCode
maghamed dac634d
Make Indexers to use SourceId instead of SourceCode
maghamed 5364986
Make Indexers to use SourceId instead of SourceCode
maghamed c6e0ebf
Remove Source Id from Admin UI
maghamed abacf95
remove Source ID from API Interfaces
maghamed 1ce881b
remove Source ID from API Interfaces
maghamed 54f6e59
Added setSourceId method to the Source model
deadlexus 948d4f6
source_id field constant moved from 'Source' model to resource model
deadlexus e8f84d4
Removed setSourceId method from source model; fixed integration test;
b9de5f5
Fixed integration test
5e93ef5
Fixed static test
580e823
MSI: Task 290 import export source code
79972ce
MSI: Task 290 import export source code
9f210cd
MSI: Task 290 import export source code
902ca87
MSI: Task 290 import export source code
6d7782b
MSI: Task 290 import export source code
8b8ee98
MSI: Task 290 import export source code
16948bd
MSI: Task 290 import export source code
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
app/code/Magento/Inventory/Model/Source/Command/GetByCode.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Inventory\Model\Source\Command; | ||
|
||
use Magento\Framework\Exception\NoSuchEntityException; | ||
use Magento\Inventory\Model\ResourceModel\Source as SourceResourceModel; | ||
use Magento\InventoryApi\Api\Data\SourceInterface; | ||
use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
class GetByCode implements GetByCodeInterface | ||
{ | ||
/** | ||
* @var SourceResourceModel | ||
*/ | ||
private $sourceResource; | ||
|
||
/** | ||
* @var SourceInterfaceFactory | ||
*/ | ||
private $sourceFactory; | ||
|
||
/** | ||
* @param SourceResourceModel $sourceResource | ||
* @param SourceInterfaceFactory $sourceFactory | ||
*/ | ||
public function __construct( | ||
SourceResourceModel $sourceResource, | ||
SourceInterfaceFactory $sourceFactory | ||
) { | ||
$this->sourceResource = $sourceResource; | ||
$this->sourceFactory = $sourceFactory; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function execute(string $code): SourceInterface | ||
{ | ||
/** @var SourceInterface $source */ | ||
$source = $this->sourceFactory->create(); | ||
$this->sourceResource->load($source, $code, SourceInterface::CODE); | ||
|
||
if (null === $source->getSourceId()) { | ||
throw new NoSuchEntityException(__('Source with code "%value" does not exist.', ['value' => $code])); | ||
} | ||
return $source; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/code/Magento/Inventory/Model/Source/Command/GetByCodeInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Inventory\Model\Source\Command; | ||
|
||
use Magento\Framework\Exception\NoSuchEntityException; | ||
use Magento\InventoryApi\Api\Data\SourceInterface; | ||
|
||
/** | ||
* Get Source by code command (Service Provider Interface - SPI) | ||
* | ||
* Separate command interface to which Repository proxies initial Get call, could be considered as SPI - Interfaces | ||
* that you should extend and implement to customize current behaviour, but NOT expected to be used (called) in the code | ||
* of business logic directly | ||
* | ||
* @see \Magento\InventoryApi\Api\SourceRepositoryInterface | ||
* @api | ||
*/ | ||
interface GetByCodeInterface | ||
{ | ||
/** | ||
* Get Source data by given code | ||
* | ||
* @param string $code | ||
* @return SourceInterface | ||
* @throws NoSuchEntityException | ||
*/ | ||
public function execute(string $code): SourceInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not correct to cast to
int
here,because when the factory creates SourceId there is no guarantee that factory will set something to SourceId
that's why PHP Doc says (
@return int|null
)