Skip to content

Commit 9741814

Browse files
author
Vitaliy
authored
Merge pull request #479 from magento/forwardport/3.1.0-3.2.0
Forwardport: 3.1.0 to 3.2.0
2 parents a7a605f + 7af7c7e commit 9741814

File tree

40 files changed

+1302
-176
lines changed

40 files changed

+1302
-176
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,24 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
66

77
## 3.2.0
88

99
## 3.1.0
1010

11+
### Added
12+
13+
- Extended `.phpstorm.meta.php` for more convenient autocomplete [#467](https://github.com/magento/magento2-phpstorm-plugin/pull/467)
14+
- Code generation for message queue in [#411](https://github.com/magento/magento2-phpstorm-plugin/pull/411)
15+
- Code generation for declarative schema [#453](https://github.com/magento/magento2-phpstorm-plugin/pull/453)
16+
- Inspection warning for disabled observer [#432](https://github.com/magento/magento2-phpstorm-plugin/pull/432)
17+
- The action item to the context menu to copy file path in the Magento format [#451](https://github.com/magento/magento2-phpstorm-plugin/pull/451)
18+
19+
### Fixed
20+
21+
- The null pointer exception on the Create Module Dialog
22+
1123
## 3.0.4
1224

1325
### Fixed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![Version](http://phpstorm.espend.de/badge/8024/version)](https://plugins.jetbrains.com/plugin/8024)
1010
[![Downloads](http://phpstorm.espend.de/badge/8024/downloads)](https://plugins.jetbrains.com/plugin/8024)
1111
![merge-chance-badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fmerge-chance.info%2Fbadge%3Frepo%3Dmagento/magento2-phpstorm-plugin)
12+
[![Made With Love](https://img.shields.io/badge/Made%20With-Love-orange.svg)](https://magento.com)
1213

1314
## Installation
1415

resources/META-INF/plugin.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,5 +239,4 @@
239239
<frameworkUsageProvider implementation="com.magento.idea.magento2plugin.project.UsagesProvider"/>
240240
<libraryRoot id="phpstorm.meta.php" path="/.phpstorm.meta.php/" runtime="false"/>
241241
</extensions>
242-
243242
</idea-plugin>

resources/fileTemplates/internal/Magento Data Model Interface.php.ft

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,20 @@ interface ${NAME}
2828
#set ($propertyLowerCamel = $propertyData.get(4))
2929

3030
/**
31-
* @return $propertyType
31+
* Getter for $propertyUpperCamel.
32+
*
33+
* @return $propertyType|null
3234
*/
33-
public function get$propertyUpperCamel();
35+
public function get$propertyUpperCamel(): ?$propertyType;
3436

3537
/**
36-
* @param $propertyType $$propertyLowerCamel
37-
* @return $this
38+
* Setter for $propertyUpperCamel.
39+
*
40+
* @param $propertyType|null $$propertyLowerCamel
41+
*
42+
* @return void
3843
*/
39-
public function set$propertyUpperCamel($$propertyLowerCamel);
44+
public function set$propertyUpperCamel(?$propertyType $$propertyLowerCamel): void;
4045
#end
4146
#end
4247
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!--
2+
/*
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<html lang="en">
8+
<body>
9+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
10+
<tr>
11+
<td><font face="verdana" size="-1">
12+
The data model interface indicates all the setters and getters for the related data model.
13+
This used to maintain the integrity of the data, even if there is any changes in the model you will always get consistent data.
14+
</font><br>
15+
</td>
16+
</tr>
17+
</table>
18+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
19+
<tr>
20+
<td colspan="3"><font face="verdana" size="-1">Predefined variables explanation:</font></td>
21+
</tr>
22+
<tr>
23+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${NAMESPACE}</b></font></nobr></td>
24+
<td width="10">&nbsp;</td>
25+
<td width="100%" valign="top"><font face="verdana" size="-1">A fully qualified name of the field namespace without a leading slash.
26+
</font>
27+
</td>
28+
</tr>
29+
<tr>
30+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${USE}</b></font></nobr></td>
31+
<td width="10">&nbsp;</td>
32+
<td width="100%" valign="top"><font face="verdana" size="-1">List of imports separated by comma.
33+
</font>
34+
</td>
35+
</tr>
36+
<tr>
37+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${NAME}</b></font></nobr></td>
38+
<td width="10">&nbsp;</td>
39+
<td width="100%" valign="top"><font face="verdana" size="-1">PHP Class name.
40+
</font>
41+
</td>
42+
</tr>
43+
<tr>
44+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${EXTENDS}</b></font></nobr></td>
45+
<td width="10">&nbsp;</td>
46+
<td width="100%" valign="top"><font face="verdana" size="-1">Name of PHP class that the Class extends.
47+
</font>
48+
</td>
49+
</tr>
50+
<tr>
51+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${IMPLEMENTS}</b></font></nobr></td>
52+
<td width="10">&nbsp;</td>
53+
<td width="100%" valign="top"><font face="verdana" size="-1">Name of PHP class that the Class implements.
54+
</font>
55+
</td>
56+
</tr>
57+
<tr>
58+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${PROPERTIES}</b></font></nobr></td>
59+
<td width="10">&nbsp;</td>
60+
<td width="100%" valign="top"><font face="verdana" size="-1">Class member variables.
61+
</font>
62+
</td>
63+
</tr>
64+
</table>
65+
</body>
66+
</html>

resources/fileTemplates/internal/Magento Data Model.php.ft

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,75 @@
99
#foreach ($use in $uses.split(","))
1010
use $use;
1111
#end
12+
#if (${HASINTERFACE} == "true")
13+
#set ($hasInterface = true)
14+
#else
15+
#set ($hasInterface = false)
16+
#end
1217

13-
class ${NAME} #if (${EXTENDS})extends ${EXTENDS} #end #if (${IMPLEMENTS})implements ${IMPLEMENTS}#end
18+
class ${NAME} #if (${EXTENDS})extends ${EXTENDS} #end #if (${IMPLEMENTS} && $hasInterface)implements ${IMPLEMENTS}#end
1419
{
20+
#if (${PROPERTIES} && !$hasInterface)
21+
/**
22+
* String constants for property names
23+
*/
24+
#set ($properties = ${PROPERTIES})
25+
#foreach ($property in $properties.split(","))
26+
#set ($propertyData = $property.split(";"))
27+
#set ($propertyUpperSnake = $propertyData.get(0))
28+
#set ($propertyLowerSnake = $propertyData.get(1))
29+
const $propertyUpperSnake = "$propertyLowerSnake";
30+
#end
31+
32+
#end
1533
#if (${PROPERTIES})
1634
#set ($properties = ${PROPERTIES})
1735
#foreach ($property in $properties.split(","))
1836
#set ($propertyData = $property.split(";"))
1937
#set ($propertyUpperSnake = $propertyData.get(0))
38+
#set ($propertyType = $propertyData.get(2))
2039
#set ($propertyUpperCamel = $propertyData.get(3))
2140
#set ($propertyLowerCamel = $propertyData.get(4))
2241
#if(!($foreach.first))
2342

2443
#end
44+
#if ($hasInterface)
2545
/**
2646
* @inheritDoc
2747
*/
28-
public function get$propertyUpperCamel()
48+
#else
49+
/**
50+
* Getter for $propertyUpperCamel.
51+
*
52+
* @return $propertyType|null
53+
*/
54+
#end
55+
public function get$propertyUpperCamel(): ?$propertyType
2956
{
57+
#if($propertyType == 'string')
3058
return $this->getData(self::$propertyUpperSnake);
59+
#{else}
60+
return $this->getData(self::$propertyUpperSnake) === null ? null
61+
: ($propertyType) $this->getData(self::$propertyUpperSnake);
62+
#end
3163
}
3264

65+
#if ($hasInterface)
3366
/**
3467
* @inheritDoc
3568
*/
36-
public function set$propertyUpperCamel($$propertyLowerCamel)
69+
#else
70+
/**
71+
* Setter for $propertyUpperCamel.
72+
*
73+
* @param $propertyType|null $$propertyLowerCamel
74+
*
75+
* @return void
76+
*/
77+
#end
78+
public function set$propertyUpperCamel(?$propertyType $$propertyLowerCamel): void
3779
{
38-
return $this->setData(self::$propertyUpperSnake, $$propertyLowerCamel);
80+
$this->setData(self::$propertyUpperSnake, $$propertyLowerCamel);
3981
}
4082
#end
4183
#end
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!--
2+
/*
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<html lang="en">
8+
<body>
9+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
10+
<tr>
11+
<td><font face="verdana" size="-1">
12+
The data model is a stateful data transfer object (DTO) that introduces simple data PHP object that contains only getters and setters.
13+
In other words, data models are interfaces that define the list of data properties other components can expect from them.
14+
</font><br>
15+
</td>
16+
</tr>
17+
<tr>
18+
<td><font face="verdana" size="-1">
19+
Link to documentation
20+
<a href="https://www.mageplaza.com/magento-2-module-development/how-to-create-crud-model-magento-2.html">
21+
DevDocs</a>.
22+
</font><br>
23+
</td>
24+
</tr>
25+
</table>
26+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
27+
<tr>
28+
<td colspan="3"><font face="verdana" size="-1">Predefined variables explanation:</font></td>
29+
</tr>
30+
<tr>
31+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${NAMESPACE}</b></font></nobr></td>
32+
<td width="10">&nbsp;</td>
33+
<td width="100%" valign="top"><font face="verdana" size="-1">A fully qualified name of the field namespace without a leading slash.
34+
</font>
35+
</td>
36+
</tr>
37+
<tr>
38+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${USE}</b></font></nobr></td>
39+
<td width="10">&nbsp;</td>
40+
<td width="100%" valign="top"><font face="verdana" size="-1">List of imports separated by comma.
41+
</font>
42+
</td>
43+
</tr>
44+
<tr>
45+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${NAME}</b></font></nobr></td>
46+
<td width="10">&nbsp;</td>
47+
<td width="100%" valign="top"><font face="verdana" size="-1">PHP Class name.
48+
</font>
49+
</td>
50+
</tr>
51+
<tr>
52+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${EXTENDS}</b></font></nobr></td>
53+
<td width="10">&nbsp;</td>
54+
<td width="100%" valign="top"><font face="verdana" size="-1">Name of PHP class that the Class extends.
55+
</font>
56+
</td>
57+
</tr>
58+
<tr>
59+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${IMPLEMENTS}</b></font></nobr></td>
60+
<td width="10">&nbsp;</td>
61+
<td width="100%" valign="top"><font face="verdana" size="-1">Name of PHP class that the Class implements.
62+
</font>
63+
</td>
64+
</tr>
65+
<tr>
66+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${PROPERTIES}</b></font></nobr></td>
67+
<td width="10">&nbsp;</td>
68+
<td width="100%" valign="top"><font face="verdana" size="-1">Class member variables.
69+
</font>
70+
</td>
71+
</tr>
72+
</table>
73+
</body>
74+
</html>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
#parse("PHP File Header.php")
3+
#if (${NAMESPACE})
4+
5+
namespace ${NAMESPACE};
6+
#end
7+
8+
use Magento\Framework\MessageQueue\ConsumerInterface;
9+
10+
class ${CLASS_NAME} implements ConsumerInterface
11+
{
12+
public function process($maxNumberOfMessages = null)
13+
{
14+
// TODO: Implement process() method.
15+
}
16+
}

resources/fileTemplates/internal/Magento Message Queue Consumer Class.php.html

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
#parse("PHP File Header.php")
3+
#if (${NAMESPACE})
4+
5+
namespace ${NAMESPACE};
6+
#end
7+
8+
class ${CLASS_NAME}
9+
{
10+
public function execute()
11+
{
12+
//TODO: implement method
13+
}
14+
}

0 commit comments

Comments
 (0)