Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 543a1e4

Browse files
authored
Merge branch 'master' into db_guild
2 parents 2c3b48d + eaa8003 commit 543a1e4

File tree

44 files changed

+1165
-421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1165
-421
lines changed

src/_includes/upgrade/uct-error-reference.md

Lines changed: 108 additions & 9 deletions
Large diffs are not rendered by default.

src/_videos/fundamentals/add-a-javascript-module.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,15 @@ Now create two files:
4747

4848
```php
4949
<?php
50-
\Magento\Framework\Component\ComponentRegistrar::register(
51-
\Magento\Framework\Component\ComponentRegistrar::MODULE,
50+
/**
51+
* Copyright © Magento, Inc. All rights reserved.
52+
* See COPYING.txt for license details.
53+
*/
54+
55+
use Magento\Framework\Component\ComponentRegistrar;
56+
57+
ComponentRegistrar::register(
58+
ComponentRegistrar::MODULE,
5259
'Learning_Js',
5360
__DIR__
5461
);

src/_videos/fundamentals/add-new-product-attribute.md

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,14 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
7575
```php
7676
<?php
7777
/**
78-
* Copyright © 2016 Magento. All rights reserved.
78+
* Copyright © Magento, Inc. All rights reserved.
7979
* See COPYING.txt for license details.
8080
*/
81-
\Magento\Framework\Component\ComponentRegistrar::register(
82-
\Magento\Framework\Component\ComponentRegistrar::MODULE,
81+
82+
use Magento\Framework\Component\ComponentRegistrar;
83+
84+
ComponentRegistrar::register(
85+
ComponentRegistrar::MODULE,
8386
'Learning_ClothingMaterial',
8487
__DIR__
8588
);
@@ -100,12 +103,15 @@ Create the file `app/code/Learning/ClothingMaterial/Setup/InstallData.php`:
100103
```php
101104
<?php
102105
/**
103-
* Copyright © 2016 Magento. All rights reserved.
106+
* Copyright © Magento, Inc. All rights reserved.
104107
* See COPYING.txt for license details.
105108
*/
106109

107110
namespace Learning\ClothingMaterial\Setup;
108111

112+
use Magento\Catalog\Model\Product;
113+
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
114+
use Magento\Eav\Setup\EavSetupFactory;
109115
use Magento\Framework\Setup\InstallDataInterface;
110116
use Magento\Framework\Setup\ModuleContextInterface;
111117
use Magento\Framework\Setup\ModuleDataSetupInterface;
@@ -125,13 +131,13 @@ class InstallData implements InstallDataInterface
125131
* Init
126132
* @param EavSetupFactory $eavSetupFactory
127133
*/
128-
public function __construct(\Magento\Eav\Setup\EavSetupFactory $eavSetupFactory)
134+
public function __construct(EavSetupFactory $eavSetupFactory)
129135
{
130136
$this->eavSetupFactory = $eavSetupFactory;
131137
}
132138

133139
/**
134-
* {@inheritdoc}
140+
* @inheritdoc
135141
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
136142
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
137143
* @SuppressWarnings(PHPMD.NPathComplexity)
@@ -140,7 +146,7 @@ class InstallData implements InstallDataInterface
140146
{
141147
$eavSetup = $this->eavSetupFactory->create();
142148
$eavSetup->addAttribute(
143-
\Magento\Catalog\Model\Product::ENTITY,
149+
Product::ENTITY,
144150
'clothing_material',
145151
[
146152
'group' => 'General',
@@ -152,7 +158,7 @@ class InstallData implements InstallDataInterface
152158
'backend' => 'Learning\ClothingMaterial\Model\Attribute\Backend\Material',
153159
'required' => false,
154160
'sort_order' => 50,
155-
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
161+
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
156162
'is_used_in_grid' => false,
157163
'is_visible_in_grid' => false,
158164
'is_filterable_in_grid' => false,
@@ -207,13 +213,15 @@ Next, we need to create the source model:
207213
```php
208214
<?php
209215
/**
210-
* Copyright © 2016 Magento. All rights reserved.
216+
* Copyright © Magento, Inc. All rights reserved.
211217
* See COPYING.txt for license details.
212218
*/
213219

214220
namespace Learning\ClothingMaterial\Model\Attribute\Source;
215221

216-
class Material extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
222+
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
223+
224+
class Material extends AbstractSource
217225
{
218226
/**
219227
* Get all options
@@ -251,25 +259,29 @@ Now we will create a backend model:
251259
```php
252260
<?php
253261
/**
254-
* Copyright © 2016 Magento. All rights reserved.
262+
* Copyright © Magento, Inc. All rights reserved.
255263
* See COPYING.txt for license details.
256264
*/
257265

258266
namespace Learning\ClothingMaterial\Model\Attribute\Backend;
259267

260-
class Material extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
268+
use Magento\Catalog\Model\Product;
269+
use Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend;
270+
use Magento\Framework\Exception\LocalizedException;
271+
272+
class Material extends AbstractBackend
261273
{
262274
/**
263275
* Validate
264-
* @param \Magento\Catalog\Model\Product $object
265-
* @throws \Magento\Framework\Exception\LocalizedException
276+
* @param Product $object
277+
* @throws LocalizedException
266278
* @return bool
267279
*/
268280
public function validate($object)
269281
{
270282
$value = $object->getData($this->getAttribute()->getAttributeCode());
271283
if ( ($object->getAttributeSetId() == 10) && ($value == 'wool')) {
272-
throw new \Magento\Framework\Exception\LocalizedException(
284+
throw new LocalizedException(
273285
__('Bottom can not be wool.')
274286
);
275287
}
@@ -297,11 +309,19 @@ And finally, we create a frontend model to make our value bold:
297309

298310
```php
299311
<?php
312+
/**
313+
* Copyright © Magento, Inc. All rights reserved.
314+
* See COPYING.txt for license details.
315+
*/
316+
300317
namespace Learning\ClothingMaterial\Model\Attribute\Frontend;
301318

302-
class Material extends \Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend
319+
use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend;
320+
use Magento\Framework\DataObject;
321+
322+
class Material extends AbstractFrontend
303323
{
304-
public function getValue(\Magento\Framework\DataObject $object)
324+
public function getValue(DataObject $object)
305325
{
306326
$value = $object->getData($this->getAttribute()->getAttributeCode());
307327
return "<b>$value</b>";
@@ -387,4 +407,4 @@ Alternatively, you may designate a specific option sorting order as follows:
387407

388408
```php
389409
$eavSetup->addAttributeOption($options);
390-
```
410+
```

src/_videos/fundamentals/create-a-new-module.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,18 @@ Each module must have this file, which tells Magento how to locate the module. C
8686
`app/code/Learning/FirstUnit/registration.php`. Then put the following content into it:
8787

8888
```php
89-
<?php \Magento\Framework\Component\ComponentRegistrar::register(
90-
\Magento\Framework\Component\ComponentRegistrar::MODULE, 'Learning_FirstUnit',
91-
__DIR__
89+
<?php
90+
/**
91+
* Copyright © Magento, Inc. All rights reserved.
92+
* See COPYING.txt for license details.
93+
*/
94+
95+
use Magento\Framework\Component\ComponentRegistrar;
96+
97+
ComponentRegistrar::register(
98+
ComponentRegistrar::MODULE,
99+
'Learning_FirstUnit',
100+
__DIR__
92101
);
93102
```
94103

src/_videos/fundamentals/create-a-new-page.md

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,18 @@ Learning/HelloPage/etc/module.xml
5959
### registration.php
6060

6161
```php
62-
<?php /**
63-
* Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details.
64-
*/
65-
\Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Learning_HelloPage',
66-
__DIR__
62+
<?php
63+
/**
64+
* Copyright © Magento, Inc. All rights reserved.
65+
* See COPYING.txt for license details.
66+
*/
67+
68+
use Magento\Framework\Component\ComponentRegistrar;
69+
70+
ComponentRegistrar::register(
71+
ComponentRegistrar::MODULE,
72+
'Learning_HelloPage',
73+
__DIR__
6774
);
6875
```
6976

@@ -94,8 +101,9 @@ Now, since we’re working in the frontend area, we’ll add the `etc/frontend/r
94101
<?xml version="1.0"?>
95102
<!--
96103
/**
97-
* Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details.
98-
*/
104+
* Copyright © Magento, Inc. All rights reserved.
105+
* * See COPYING.txt for license details.
106+
*/
99107
-->
100108
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
101109
<router id="standard">
@@ -130,40 +138,51 @@ mkdir Controller/Page
130138
Let’s create an action file `Controller/Page/View.php`:
131139

132140
```php
133-
<?php /**
134-
* Copyright © 2016 Magento. All rights reserved.
141+
<?php
142+
/**
143+
* Copyright © Magento, Inc. All rights reserved.
135144
* See COPYING.txt for license details.
136145
*/
146+
137147
namespace Learning\HelloPage\Controller\Page;
138-
class View extends \Magento\Framework\App\Action\Action
148+
149+
use Magento\Framework\App\Action\Action;
150+
use Magento\Framework\App\Action\Context;
151+
use Magento\Framework\Controller\Result\JsonFactory;
152+
use Magento\Framework\Controller\ResultInterface;
153+
154+
class View extends Action
139155
{
140156
/**
141-
* @var \Magento\Framework\Controller\Result\JsonFactory
157+
* @var JsonFactory
142158
*/
143159
protected $resultJsonFactory;
160+
144161
/**
145-
* @param \Magento\Framework\App\Action\Context $context
146-
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
162+
* @param Context $context
163+
* @param JsonFactory $resultJsonFactory
147164
*/
148165
public function __construct(
149-
\Magento\Framework\App\Action\Context $context,
150-
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory)
151-
{
152-
$this->resultJsonFactory = $resultJsonFactory;
153-
parent::__construct($context);
154-
}
166+
Context $context,
167+
JsonFactory $resultJsonFactory
168+
) {
169+
parent::__construct($context);
170+
$this->resultJsonFactory = $resultJsonFactory;
171+
}
172+
155173
/**
156174
* View page action
157175
*
158-
* @return \Magento\Framework\Controller\ResultInterface
176+
* @return ResultInterface
159177
*/
160178
public function execute()
161179
{
162-
$result = $this->resultJsonFactory->create();
163-
$data = ['message' => 'Hello world!'];
180+
$result = $this->resultJsonFactory->create();
181+
$data = ['message' => 'Hello world!'];
164182

165-
return $result->setData($data);
166-
} }
183+
return $result->setData($data);
184+
}
185+
}
167186
```
168187

169188
Note we created a JSON-type page. This can be seen in the results factory that we specify in our constructor. In order to activate our module and our page we should run the Magento setup upgrade:

src/cloud/env/variables-deploy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ stage:
368368
```
369369

370370
{:.bs-callout-info}
371-
If you specify `\magento\Framework\Cache\Backend\RemoteSynchronizedCache` as the Redis backend model, {{ site.data.var.ct }} generates the cache configuration automatically. See an example [configuration file]({{site.baseurl}}/guides/v2.4/config-guide/cache/two-level-cache.html#configuration-example) in the _{{site.data.var.ee}} Configuration Guide_. To override the generated cache configuration, use the [CACHE_CONFIGURATION]({{site.baseurl}}/cloud/env/variables-deploy.html#cache_configuration) deploy variable.
371+
If you specify `\Magento\Framework\Cache\Backend\RemoteSynchronizedCache` as the Redis backend model, {{ site.data.var.ct }} generates the cache configuration automatically. See an example [configuration file]({{site.baseurl}}/guides/v2.4/config-guide/cache/two-level-cache.html#configuration-example) in the _{{site.data.var.ee}} Configuration Guide_. To override the generated cache configuration, use the [CACHE_CONFIGURATION]({{site.baseurl}}/cloud/env/variables-deploy.html#cache_configuration) deploy variable.
372372

373373
### `REDIS_USE_SLAVE_CONNECTION`
374374

src/cloud/release-notes/cloud-release-archive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ The ece-tools version 2002.0.11 is required for 2.2.4 compatibility.
498498

499499
## v2002.0.9
500500

501-
{.bs-callout-info}
501+
{:.bs-callout-info}
502502
You must [upgrade the {{site.data.var.ece}} metapackage]({{ site.baseurl }}/cloud/project/project-upgrade-parent.html) to get this and all future updates.
503503

504504
- {:.new}<!-- MAGECLOUD-1086 -->**ece-tools**—The `{{site.data.var.ct}}` package now supports {{site.data.var.ee}} 2.1.x.

src/common/js/qpt.app.min.js

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/contributor-guide/backward-compatible-development/index.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ Prefix the type name with a question mark when declaring a parameter with a `nul
136136
{% collapsible Example Code %}
137137

138138
```php
139+
<?php
140+
/**
141+
* Copyright © Magento, Inc. All rights reserved.
142+
* See COPYING.txt for license details.
143+
*/
144+
145+
use Magento\Framework\App\ObjectManager;
146+
139147
class ExistingClass
140148
{
141149
/** @var \New\Dependency\Interface */
@@ -145,10 +153,10 @@ class ExistingClass
145153
\Old\Dependency\Interface $oldDependency,
146154
$oldRequiredConstructorParameter,
147155
$oldOptionalConstructorParameter = null,
148-
?\New\Dependency\Interface $newDependency = null
156+
\New\Dependency\Interface $newDependency = null
149157
) {
150158
...
151-
$this->newDependency = $newDependency ?: \Magento\Framework\App\ObjectManager::getInstance()->get(\New\Dependency\Interface::class);
159+
$this->newDependency = $newDependency ?: ObjectManager::getInstance()->get(\New\Dependency\Interface::class);
152160
}
153161

154162
public function existingFunction()

0 commit comments

Comments
 (0)