Skip to content

Commit f9ebaca

Browse files
committed
MC-40538: When entering example.com/0 into browser the homepage is shown (example.com)
1 parent 2ceeea4 commit f9ebaca

File tree

7 files changed

+51
-33
lines changed

7 files changed

+51
-33
lines changed

app/code/Magento/Customer/Model/Address/AbstractAddress.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class AbstractAddress extends AbstractExtensibleModel implements AddressModelInt
140140
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
141141
* @param array $data
142142
* @param CompositeValidator $compositeValidator
143-
* @param \Magento\Framework\Validator\ValidatorInterface|null $modelValidator
143+
*
144144
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
145145
*/
146146
public function __construct(
@@ -160,8 +160,7 @@ public function __construct(
160160
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
161161
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
162162
array $data = [],
163-
CompositeValidator $compositeValidator = null,
164-
?\Magento\Framework\Validator\ValidatorInterface $modelValidator = null
163+
CompositeValidator $compositeValidator = null
165164
) {
166165
$this->_directoryData = $directoryData;
167166
$data = $this->_implodeArrayField($data);
@@ -183,8 +182,7 @@ public function __construct(
183182
$customAttributeFactory,
184183
$resource,
185184
$resourceCollection,
186-
$data,
187-
$modelValidator
185+
$data
188186
);
189187
}
190188

app/code/Magento/Quote/Model/Quote/Address.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Magento\Customer\Api\Data\AddressInterfaceFactory;
1111
use Magento\Customer\Api\Data\RegionInterfaceFactory;
1212
use Magento\Customer\Model\Address\AbstractAddress;
13-
use Magento\Customer\Model\Address\CompositeValidator;
1413
use Magento\Customer\Model\Address\Mapper;
1514
use Magento\Directory\Helper\Data;
1615
use Magento\Directory\Model\CountryFactory;
@@ -335,7 +334,7 @@ class Address extends AbstractAddress implements
335334
* @param array $data
336335
* @param Json $serializer
337336
* @param StoreManagerInterface $storeManager
338-
* @param CompositeValidator $compositeValidator
337+
*
339338
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
340339
*/
341340
public function __construct(
@@ -372,8 +371,7 @@ public function __construct(
372371
AbstractDb $resourceCollection = null,
373372
array $data = [],
374373
Json $serializer = null,
375-
StoreManagerInterface $storeManager = null,
376-
CompositeValidator $compositeValidator = null
374+
StoreManagerInterface $storeManager = null
377375
) {
378376
$this->_scopeConfig = $scopeConfig;
379377
$this->_addressItemFactory = $addressItemFactory;
@@ -394,7 +392,6 @@ public function __construct(
394392
$this->totalsReader = $totalsReader;
395393
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
396394
$this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class);
397-
398395
parent::__construct(
399396
$context,
400397
$registry,
@@ -411,9 +408,7 @@ public function __construct(
411408
$dataObjectHelper,
412409
$resource,
413410
$resourceCollection,
414-
$data,
415-
$compositeValidator,
416-
$this->validator
411+
$data
417412
);
418413
}
419414

@@ -1427,6 +1422,14 @@ public function getAllBaseTotalAmounts()
14271422

14281423
/******************************* End Total Collector Interface *******************************************/
14291424

1425+
/**
1426+
* @inheritdoc
1427+
*/
1428+
protected function _getValidationRulesBeforeSave()
1429+
{
1430+
return $this->validator;
1431+
}
1432+
14301433
/**
14311434
* @inheritdoc
14321435
*/

app/code/Magento/Store/Model/Store.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ class Store extends AbstractExtensibleModel implements
332332
*/
333333
private $pillPut;
334334

335+
/**
336+
* @var \Magento\Store\Model\Validation\StoreValidator
337+
*/
338+
private $modelValidator;
339+
335340
/**
336341
* @param \Magento\Framework\Model\Context $context
337342
* @param \Magento\Framework\Registry $registry
@@ -360,6 +365,7 @@ class Store extends AbstractExtensibleModel implements
360365
* @param \Magento\Framework\Event\ManagerInterface|null $eventManager
361366
* @param \Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface|null $pillPut
362367
* @param \Magento\Store\Model\Validation\StoreValidator|null $modelValidator
368+
*
363369
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
364370
*/
365371
public function __construct(
@@ -389,7 +395,7 @@ public function __construct(
389395
array $data = [],
390396
\Magento\Framework\Event\ManagerInterface $eventManager = null,
391397
\Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface $pillPut = null,
392-
?\Magento\Framework\Validator\ValidatorInterface $modelValidator = null
398+
\Magento\Store\Model\Validation\StoreValidator $modelValidator = null
393399
) {
394400
$this->_coreFileStorageDatabase = $coreFileStorageDatabase;
395401
$this->_config = $config;
@@ -412,6 +418,8 @@ public function __construct(
412418
->get(\Magento\Framework\Event\ManagerInterface::class);
413419
$this->pillPut = $pillPut ?: \Magento\Framework\App\ObjectManager::getInstance()
414420
->get(\Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface::class);
421+
$this->modelValidator = $modelValidator ?: \Magento\Framework\App\ObjectManager::getInstance()
422+
->get(\Magento\Store\Model\Validation\StoreValidator::class);
415423

416424
parent::__construct(
417425
$context,
@@ -420,8 +428,7 @@ public function __construct(
420428
$customAttributeFactory,
421429
$resource,
422430
$resourceCollection,
423-
$data,
424-
$modelValidator
431+
$data
425432
);
426433
}
427434

@@ -474,6 +481,14 @@ protected function _getSession()
474481
return $this->_session;
475482
}
476483

484+
/**
485+
* @inheritDoc
486+
*/
487+
protected function _getValidationRulesBeforeSave()
488+
{
489+
return $this->modelValidator;
490+
}
491+
477492
/**
478493
* Loading store data
479494
*

app/code/Magento/Store/etc/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
<argument name="session" xsi:type="object" shared="false">Magento\Framework\Session\Generic\Proxy</argument>
9898
<argument name="isCustomEntryPoint" xsi:type="init_parameter">Magento\Store\Model\Store::CUSTOM_ENTRY_POINT_PARAM</argument>
9999
<argument name="url" xsi:type="object" shared="false">Magento\Framework\UrlInterface</argument>
100-
<argument name="modelValidator" xsi:type="object">Magento\Store\Model\Validation\StoreValidator</argument>
101100
</arguments>
102101
</type>
103102
<type name="Magento\Store\Model\StoreManager">

app/code/Magento/Tax/Model/Calculation/Rule.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ class Rule extends \Magento\Framework\Model\AbstractExtensibleModel implements T
4343
*/
4444
protected $_calculation;
4545

46+
/**
47+
* @var \Magento\Tax\Model\Calculation\Rule\Validator
48+
*/
49+
protected $validator;
50+
4651
/**
4752
* Name of object id field
4853
*
@@ -76,15 +81,15 @@ public function __construct(
7681
array $data = []
7782
) {
7883
$this->_calculation = $calculation;
84+
$this->validator = $validator;
7985
parent::__construct(
8086
$context,
8187
$registry,
8288
$extensionFactory,
8389
$customAttributeFactory,
8490
$resource,
8591
$resourceCollection,
86-
$data,
87-
$validator
92+
$data
8893
);
8994
$this->_init(\Magento\Tax\Model\ResourceModel\Calculation\Rule::class);
9095
$this->_taxClass = $taxClass;
@@ -275,6 +280,14 @@ protected function _getUniqueValues($values)
275280
return array_values(array_unique($values));
276281
}
277282

283+
/**
284+
* {@inheritdoc}
285+
*/
286+
protected function _getValidationRulesBeforeSave()
287+
{
288+
return $this->validator;
289+
}
290+
278291
/**
279292
* Set tax rule code
280293
*

lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ abstract class AbstractExtensibleModel extends AbstractModel implements
5555
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
5656
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
5757
* @param array $data
58-
* @param \Magento\Framework\Validator\ValidatorInterface|null $modelValidator
5958
*/
6059
public function __construct(
6160
\Magento\Framework\Model\Context $context,
@@ -64,13 +63,12 @@ public function __construct(
6463
AttributeValueFactory $customAttributeFactory,
6564
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
6665
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
67-
array $data = [],
68-
?\Magento\Framework\Validator\ValidatorInterface $modelValidator = null
66+
array $data = []
6967
) {
7068
$this->extensionAttributesFactory = $extensionFactory;
7169
$this->customAttributeFactory = $customAttributeFactory;
7270
$data = $this->filterCustomAttributes($data);
73-
parent::__construct($context, $registry, $resource, $resourceCollection, $data, $modelValidator);
71+
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
7472
if (isset($data['id'])) {
7573
$this->setId($data['id']);
7674
}

lib/internal/Magento/Framework/Model/AbstractModel.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,26 +163,19 @@ abstract class AbstractModel extends \Magento\Framework\DataObject
163163
*/
164164
protected $storedData = [];
165165

166-
/**
167-
* @var \Magento\Framework\Validator\ValidatorInterface|null
168-
*/
169-
private $modelValidator;
170-
171166
/**
172167
* @param \Magento\Framework\Model\Context $context
173168
* @param \Magento\Framework\Registry $registry
174169
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
175170
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
176171
* @param array $data
177-
* @param \Magento\Framework\Validator\ValidatorInterface|null $modelValidator
178172
*/
179173
public function __construct(
180174
\Magento\Framework\Model\Context $context,
181175
\Magento\Framework\Registry $registry,
182176
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
183177
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
184-
array $data = [],
185-
?\Magento\Framework\Validator\ValidatorInterface $modelValidator = null
178+
array $data = []
186179
) {
187180
$this->_registry = $registry;
188181
$this->_appState = $context->getAppState();
@@ -192,7 +185,6 @@ public function __construct(
192185
$this->_resourceCollection = $resourceCollection;
193186
$this->_logger = $context->getLogger();
194187
$this->_actionValidator = $context->getActionValidator();
195-
$this->modelValidator = $modelValidator;
196188

197189
if (method_exists($this->_resource, 'getIdFieldName')
198190
|| $this->_resource instanceof \Magento\Framework\DataObject
@@ -783,7 +775,7 @@ protected function _createValidatorBeforeSave()
783775
*/
784776
protected function _getValidationRulesBeforeSave()
785777
{
786-
return $this->modelValidator;
778+
return null;
787779
}
788780

789781
/**

0 commit comments

Comments
 (0)