Skip to content

Commit 0e227f3

Browse files
committed
MAGETWO-70985: Deprecate Repository generation logic and Materialize Repositories being generated now
- Marked auto generated repositories as deprecated
1 parent 67ce7c8 commit 0e227f3

File tree

4 files changed

+75
-8
lines changed

4 files changed

+75
-8
lines changed

app/code/Magento/Payment/Model/Method/AbstractMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public function canAuthorize()
318318
* Check capture availability
319319
*
320320
* @return bool
321-
* @apiчс
321+
* @api
322322
* @deprecated 2.1.0
323323
*/
324324
public function canCapture()

lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ protected function _getDefaultConstructorDefinition()
217217
/**
218218
* Returns get() method
219219
*
220-
* @return string
220+
* @return array
221221
*/
222222
protected function _getGetMethod()
223223
{
@@ -266,6 +266,9 @@ protected function _getGetMethod()
266266
'name' => 'throws',
267267
'description' => '\\' . NoSuchEntityException::class,
268268
],
269+
[
270+
'name' => 'deprecated'
271+
],
269272
],
270273
]
271274
];
@@ -274,7 +277,7 @@ protected function _getGetMethod()
274277
/**
275278
* Returns register() method
276279
*
277-
* @return string
280+
* @return array
278281
*/
279282
protected function _getCreateFromArrayMethod()
280283
{
@@ -299,6 +302,9 @@ protected function _getCreateFromArrayMethod()
299302
'name' => 'return',
300303
'description' => $this->_getResultClassName(),
301304
],
305+
[
306+
'name' => 'deprecated'
307+
],
302308
],
303309
]
304310
];
@@ -307,7 +313,7 @@ protected function _getCreateFromArrayMethod()
307313
/**
308314
* Returns register() method
309315
*
310-
* @return string
316+
* @return array
311317
*/
312318
protected function _getCreateMethod()
313319
{
@@ -332,6 +338,9 @@ protected function _getCreateMethod()
332338
'name' => 'return',
333339
'description' => $this->getSourceClassName(),
334340
],
341+
[
342+
'name' => 'deprecated'
343+
]
335344
],
336345
]
337346
];
@@ -340,7 +349,7 @@ protected function _getCreateMethod()
340349
/**
341350
* Returns register() method
342351
*
343-
* @return string
352+
* @return array
344353
*/
345354
protected function _getFlushMethod()
346355
{
@@ -354,15 +363,19 @@ protected function _getFlushMethod()
354363
'body' => $body,
355364
'docblock' => [
356365
'shortDescription' => 'Perform persist operations',
357-
'tags' => [],
366+
'tags' => [
367+
[
368+
'name' => 'deprecated'
369+
],
370+
],
358371
]
359372
];
360373
}
361374

362375
/**
363376
* Returns persist() method
364377
*
365-
* @return string
378+
* @return array
366379
*/
367380
protected function _getSaveMethod()
368381
{
@@ -390,6 +403,9 @@ protected function _getSaveMethod()
390403
'name' => 'return',
391404
'description' => $this->getSourceClassName(),
392405
],
406+
[
407+
'name' => 'deprecated'
408+
],
393409
],
394410
]
395411
];
@@ -426,6 +442,9 @@ protected function _getDeleteMethod()
426442
'name' => 'return',
427443
'description' => 'bool',
428444
],
445+
[
446+
'name' => 'deprecated'
447+
],
429448
],
430449
]
431450
];
@@ -463,6 +482,9 @@ protected function _getDeleteByIdMethod()
463482
'name' => 'return',
464483
'description' => 'bool',
465484
],
485+
[
486+
'name' => 'deprecated'
487+
],
466488
],
467489
]
468490
];
@@ -492,6 +514,9 @@ protected function _getRemoveMethod()
492514
'name' => 'param',
493515
'description' => $this->getSourceClassName() . ' $entity',
494516
],
517+
[
518+
'name' => 'deprecated'
519+
],
495520
],
496521
]
497522
];
@@ -500,7 +525,7 @@ protected function _getRemoveMethod()
500525
/**
501526
* Returns getList() method
502527
*
503-
* @return string
528+
* @return array
504529
*/
505530
protected function _getGetListMethod()
506531
{
@@ -528,6 +553,9 @@ protected function _getGetListMethod()
528553
'name' => 'return',
529554
'description' => $this->getSourceClassName() . '[]',
530555
],
556+
[
557+
'name' => 'deprecated'
558+
],
531559
],
532560
]
533561
];
@@ -624,6 +652,19 @@ protected function _generateCode()
624652
return $this->_getGeneratedCode();
625653
}
626654

655+
/**
656+
* @inheritdoc
657+
*/
658+
protected function _getClassDocBlock()
659+
{
660+
$docBlock = parent::_getClassDocBlock();
661+
$docBlock['tags'] = [
662+
['name' => 'deprecated', 'description' => '2.2.0'],
663+
['name' => 'see', 'description' => '\\' . self::class]
664+
];
665+
return $docBlock;
666+
}
667+
627668
/**
628669
* Get source class name
629670
*

lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/SampleRepository.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ namespace Magento\Framework\ObjectManager\Code\Generator;
22

33
/**
44
* Repository class for @see \Magento\Framework\ObjectManager\Code\Generator\SampleInterface
5+
*
6+
* @deprecated 2.2.0
7+
* @see \Magento\Framework\ObjectManager\Code\Generator\Repository
58
*/
69
class SampleRepository implements SampleRepositoryInterface
710
{
@@ -63,6 +66,7 @@ class SampleRepository implements SampleRepositoryInterface
6366
* @return \Magento\Framework\ObjectManager\Code\Generator\SampleInterface
6467
* @throws \Magento\Framework\Exception\InputException
6568
* @throws \Magento\Framework\Exception\NoSuchEntityException
69+
* @deprecated
6670
*/
6771
public function get($id)
6872
{
@@ -84,6 +88,7 @@ class SampleRepository implements SampleRepositoryInterface
8488
*
8589
* @param array $data
8690
* @return \Magento\Framework\ObjectManager\Code\Generator\SampleInterface
91+
* @deprecated
8792
*/
8893
public function create(\Magento\Framework\ObjectManager\Code\Generator\SampleInterface $entity)
8994
{
@@ -95,6 +100,7 @@ class SampleRepository implements SampleRepositoryInterface
95100
*
96101
* @param array $data
97102
* @return \Magento\Framework\ObjectManager\Code\Generator\SampleRepository
103+
* @deprecated
98104
*/
99105
public function createFromArray(array $data)
100106
{
@@ -106,6 +112,7 @@ class SampleRepository implements SampleRepositoryInterface
106112
*
107113
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
108114
* @return \Magento\Framework\ObjectManager\Code\Generator\SampleInterface[]
115+
* @deprecated
109116
*/
110117
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
111118
{
@@ -119,6 +126,7 @@ class SampleRepository implements SampleRepositoryInterface
119126
* Register entity to delete
120127
*
121128
* @param \Magento\Framework\ObjectManager\Code\Generator\SampleInterface $entity
129+
* @deprecated
122130
*/
123131
public function remove(\Magento\Framework\ObjectManager\Code\Generator\SampleInterface $entity)
124132
{
@@ -130,6 +138,7 @@ class SampleRepository implements SampleRepositoryInterface
130138
*
131139
* @param \Magento\Framework\ObjectManager\Code\Generator\SampleInterface $entity
132140
* @return bool
141+
* @deprecated
133142
*/
134143
public function delete(\Magento\Framework\ObjectManager\Code\Generator\SampleInterface $entity)
135144
{
@@ -142,6 +151,7 @@ class SampleRepository implements SampleRepositoryInterface
142151
*
143152
* @param int $id
144153
* @return bool
154+
* @deprecated
145155
*/
146156
public function deleteById($id)
147157
{
@@ -152,6 +162,8 @@ class SampleRepository implements SampleRepositoryInterface
152162

153163
/**
154164
* Perform persist operations
165+
*
166+
* @deprecated
155167
*/
156168
public function flush()
157169
{
@@ -166,6 +178,7 @@ class SampleRepository implements SampleRepositoryInterface
166178
*
167179
* @param \Magento\Framework\ObjectManager\Code\Generator\SampleInterface $entity
168180
* @return \Magento\Framework\ObjectManager\Code\Generator\SampleInterface
181+
* @deprecated
169182
*/
170183
public function save(\Magento\Framework\ObjectManager\Code\Generator\SampleInterface $entity)
171184
{

lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/TSampleRepository.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ namespace Magento\Framework\ObjectManager\Code\Generator;
22

33
/**
44
* Repository class for @see \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface
5+
*
6+
* @deprecated 2.2.0
7+
* @see \Magento\Framework\ObjectManager\Code\Generator\Repository
58
*/
69
class TSampleRepository implements TSampleRepositoryInterface
710
{
@@ -63,6 +66,7 @@ class TSampleRepository implements TSampleRepositoryInterface
6366
* @return \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface
6467
* @throws \Magento\Framework\Exception\InputException
6568
* @throws \Magento\Framework\Exception\NoSuchEntityException
69+
* @deprecated
6670
*/
6771
public function get(int $id) : \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface
6872
{
@@ -84,6 +88,7 @@ class TSampleRepository implements TSampleRepositoryInterface
8488
*
8589
* @param array $data
8690
* @return \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface
91+
* @deprecated
8792
*/
8893
public function create(\Magento\Framework\ObjectManager\Code\Generator\TSampleInterface $entity)
8994
{
@@ -95,6 +100,7 @@ class TSampleRepository implements TSampleRepositoryInterface
95100
*
96101
* @param array $data
97102
* @return \Magento\Framework\ObjectManager\Code\Generator\TSampleRepository
103+
* @deprecated
98104
*/
99105
public function createFromArray(array $data)
100106
{
@@ -106,6 +112,7 @@ class TSampleRepository implements TSampleRepositoryInterface
106112
*
107113
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
108114
* @return \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface[]
115+
* @deprecated
109116
*/
110117
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
111118
{
@@ -119,6 +126,7 @@ class TSampleRepository implements TSampleRepositoryInterface
119126
* Register entity to delete
120127
*
121128
* @param \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface $entity
129+
* @deprecated
122130
*/
123131
public function remove(\Magento\Framework\ObjectManager\Code\Generator\TSampleInterface $entity)
124132
{
@@ -130,6 +138,7 @@ class TSampleRepository implements TSampleRepositoryInterface
130138
*
131139
* @param \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface $entity
132140
* @return bool
141+
* @deprecated
133142
*/
134143
public function delete(\Magento\Framework\ObjectManager\Code\Generator\TSampleInterface $entity) : bool
135144
{
@@ -142,6 +151,7 @@ class TSampleRepository implements TSampleRepositoryInterface
142151
*
143152
* @param int $id
144153
* @return bool
154+
* @deprecated
145155
*/
146156
public function deleteById($id)
147157
{
@@ -152,6 +162,8 @@ class TSampleRepository implements TSampleRepositoryInterface
152162

153163
/**
154164
* Perform persist operations
165+
*
166+
* @deprecated
155167
*/
156168
public function flush()
157169
{
@@ -166,6 +178,7 @@ class TSampleRepository implements TSampleRepositoryInterface
166178
*
167179
* @param \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface $entity
168180
* @return \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface
181+
* @deprecated
169182
*/
170183
public function save(\Magento\Framework\ObjectManager\Code\Generator\TSampleInterface $entity) : \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface
171184
{

0 commit comments

Comments
 (0)