Skip to content

Commit 55ac6a0

Browse files
authored
Merge pull request #59 from magento-cia/cia-2.4.7-beta3-develop-2.4-develop-sync-02162024
Cia 2.4.7 beta3 develop 2.4 develop sync 02162024
2 parents d98a818 + 2003f63 commit 55ac6a0

File tree

22 files changed

+53
-28
lines changed

22 files changed

+53
-28
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Installing sample data is optional.
55
Technically, sample data is a set of regular Magento modules, which can be deployed and installed together with the Magento instance, or later in the scope of upgrade.
66

77
## Deploy Sample Data
8+
89
You can deploy sample data from one of the following sources:
910

1011
* From the Magento composer repository, optionally using Magento CLI
@@ -49,9 +50,11 @@ To deploy sample data from the GitHub repository:
4950
2. Link the sample data and your Magento instance by running: `# php -f <sample-data_clone_dir>/dev/tools/build-sample-data.php -- --ce-source="<path_to_your_magento_instance>"`
5051

5152
## Install Sample Data
53+
5254
Once the sample data is deployed, it will be installed automatically when you install or upgrade your Magento instance by using the command line.
5355

5456
## Uninstall Sample Data
57+
5558
To remove the sample data modules from the code base, run one of the following commands from the Magento root directory:
5659

5760
* If sample data was deployed from the composer repository, run: `# bin/magento sampledata:remove`
@@ -61,6 +64,7 @@ To remove the sample data modules from the code base, run one of the following c
6164
To delete all the products and other entities provided by the sample data modules, delete the database and reinstall Magento with a clean database.
6265

6366
## Reinstall Sample Data
67+
6468
If you have deleted certain entities provided by sample data and want to restore them, take the following steps:
6569

6670
1. From the Magento root directory, run the following command: `# bin/magento sampledata:reset`
@@ -69,4 +73,5 @@ If you have deleted certain entities provided by sample data and want to restore
6973
The deleted sample data entities will be restored. Those entities, which were changed, will preserve these changes and will not be restored to the default view.
7074

7175
## Documentation
72-
You can find the more detailed description of sample data manipulation procedures at [http://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli-sample-data.html](http://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli-sample-data.html)
76+
77+
You can find the more detailed description of sample data manipulation procedures at [Sample data overview](https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/next-steps/sample-data/overview.html).

app/code/Magento/BundleSampleData/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-bundle-sample-data",
33
"description": "N/A",
44
"require": {
5-
"php": "~8.1.0||~8.2.0",
5+
"php": "~8.1.0||~8.2.0||~8.3.0",
66
"magento/framework": "*",
77
"magento/module-bundle": "*",
88
"magento/module-catalog-sample-data": "*",

app/code/Magento/CatalogRuleSampleData/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-catalog-rule-sample-data",
33
"description": "N/A",
44
"require": {
5-
"php": "~8.1.0||~8.2.0",
5+
"php": "~8.1.0||~8.2.0||~8.3.0",
66
"magento/framework": "*",
77
"magento/module-catalog-rule": "*",
88
"magento/module-store": "*",

app/code/Magento/CatalogSampleData/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-catalog-sample-data",
33
"description": "N/A",
44
"require": {
5-
"php": "~8.1.0||~8.2.0",
5+
"php": "~8.1.0||~8.2.0||~8.3.0",
66
"magento/framework": "*",
77
"magento/module-store": "*",
88
"magento/module-eav": "*",

app/code/Magento/CmsSampleData/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-cms-sample-data",
33
"description": "N/A",
44
"require": {
5-
"php": "~8.1.0||~8.2.0",
5+
"php": "~8.1.0||~8.2.0||~8.3.0",
66
"magento/framework": "*",
77
"magento/module-cms": "*",
88
"magento/module-theme-sample-data": "*",

app/code/Magento/ConfigurableSampleData/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-configurable-sample-data",
33
"description": "N/A",
44
"require": {
5-
"php": "~8.1.0||~8.2.0",
5+
"php": "~8.1.0||~8.2.0||~8.3.0",
66
"magento/framework": "*",
77
"magento/module-configurable-product": "*",
88
"magento/module-product-links-sample-data": "*",

app/code/Magento/CustomerSampleData/Model/Customer.php

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\CustomerSampleData\Model;
77

8+
use Magento\Customer\Api\CustomerMetadataInterface;
89
use Magento\Customer\Api\Data\RegionInterface;
910
use Magento\Framework\Serialize\Serializer\Json;
1011
use Magento\Framework\Setup\SampleData\Context as SampleDataContext;
@@ -79,6 +80,11 @@ class Customer
7980
*/
8081
private $serializer;
8182

83+
/**
84+
* @var CustomerMetadataInterface
85+
*/
86+
private $customerMetadata;
87+
8288
/**
8389
* @param SampleDataContext $sampleDataContext
8490
* @param \Magento\Directory\Model\CountryFactory $countryFactory
@@ -89,7 +95,8 @@ class Customer
8995
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
9096
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
9197
* @param \Magento\Framework\App\State $appState
92-
* @param Json|null $serializer
98+
* @param Json $serializer
99+
* @param CustomerMetadataInterface $customerMetadata
93100
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
94101
*/
95102
public function __construct(
@@ -102,7 +109,8 @@ public function __construct(
102109
\Magento\Store\Model\StoreManagerInterface $storeManager,
103110
\Magento\Framework\Api\DataObjectHelper $dataObjectHelper,
104111
\Magento\Framework\App\State $appState,
105-
Json $serializer = null
112+
Json $serializer,
113+
CustomerMetadataInterface $customerMetadata
106114
) {
107115
$this->fixtureManager = $sampleDataContext->getFixtureManager();
108116
$this->csvReader = $sampleDataContext->getCsvReader();
@@ -114,7 +122,8 @@ public function __construct(
114122
$this->storeManager = $storeManager;
115123
$this->dataObjectHelper = $dataObjectHelper;
116124
$this->appState = $appState;
117-
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()->get(Json::class);
125+
$this->serializer = $serializer;
126+
$this->customerMetadata = $customerMetadata;
118127
}
119128

120129
/**
@@ -246,14 +255,25 @@ protected function getDefaultCustomerAddress()
246255
*/
247256
protected function convertRowData($row, $data)
248257
{
258+
$genders = [];
259+
$genderAttr = $this->customerMetadata->getAttributeMetadata('gender');
260+
foreach ($genderAttr->getOptions() as $genderOption) {
261+
$genders[$genderOption->getValue()] = $genderOption->getLabel();
262+
}
263+
249264
foreach ($row as $field => $value) {
250265
if (isset($data[$field])) {
251-
if ($field == 'street') {
252-
$data[$field] = $this->serializer->unserialize($value);
266+
if ($field === 'password') {
253267
continue;
254268
}
255-
if ($field == 'password') {
256-
continue;
269+
270+
switch ($field) {
271+
case 'street':
272+
$value = $this->serializer->unserialize($value);
273+
break;
274+
case 'gender':
275+
$value = array_search($value, $genders);
276+
break;
257277
}
258278
$data[$field] = $value;
259279
}

app/code/Magento/CustomerSampleData/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-customer-sample-data",
33
"description": "N/A",
44
"require": {
5-
"php": "~8.1.0||~8.2.0",
5+
"php": "~8.1.0||~8.2.0||~8.3.0",
66
"magento/framework": "*",
77
"magento/module-customer": "*",
88
"magento/module-directory": "*",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
firstname,lastname,email,password,dob,gender,street,city,region,country_id,postcode,telephone
2-
Veronica,Costello,"roni_cost@example.com","roni_cost3@example.com","1973-12-15",2,"[""6146 Honey Bluff Parkway"",""""]",Calder,Michigan,US,"49628-7978","(555) 229-3326"
2+
Veronica,Costello,"roni_cost@example.com","roni_cost3@example.com","1973-12-15","Female","[""6146 Honey Bluff Parkway"",""""]",Calder,Michigan,US,"49628-7978","(555) 229-3326"

app/code/Magento/DownloadableSampleData/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-downloadable-sample-data",
33
"description": "N/A",
44
"require": {
5-
"php": "~8.1.0||~8.2.0",
5+
"php": "~8.1.0||~8.2.0||~8.3.0",
66
"magento/framework": "*",
77
"magento/module-catalog-sample-data": "*",
88
"magento/module-downloadable": "*",

0 commit comments

Comments
 (0)