Skip to content

Commit 8390e3f

Browse files
NikitaNikita
authored andcommitted
update generated code
1 parent 67c5f37 commit 8390e3f

File tree

12 files changed

+96
-105
lines changed

12 files changed

+96
-105
lines changed

.jeeves.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Mygento:
22
Shipment:
3+
settings:
4+
php_version: 8.1
35
entities:
46
Point:
57
gui: true

Api/Data/PointInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
namespace Mygento\Shipment\Api\Data;
1010

11+
/**
12+
* @api
13+
*/
1114
interface PointInterface
1215
{
1316
public const ID = 'id';

Api/Data/PointSearchResultsInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
namespace Mygento\Shipment\Api\Data;
1010

11-
interface PointSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface
11+
use Magento\Framework\Api\SearchResultsInterface;
12+
13+
interface PointSearchResultsInterface extends SearchResultsInterface
1214
{
1315
/**
1416
* Get list of Point

Api/PointRepositoryInterface.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
namespace Mygento\Shipment\Api;
1010

11+
use Magento\Framework\Api\SearchCriteriaInterface;
12+
13+
/**
14+
* @api
15+
*/
1116
interface PointRepositoryInterface
1217
{
1318
/**
@@ -16,38 +21,36 @@ interface PointRepositoryInterface
1621
* @throws \Magento\Framework\Exception\LocalizedException
1722
* @return \Mygento\Shipment\Api\Data\PointInterface
1823
*/
19-
public function save(Data\PointInterface $entity);
24+
public function save(Data\PointInterface $entity): Data\PointInterface;
2025

2126
/**
2227
* Retrieve Point
23-
* @param int $entityId
2428
* @throws \Magento\Framework\Exception\LocalizedException
2529
* @return \Mygento\Shipment\Api\Data\PointInterface
2630
*/
27-
public function getById($entityId);
31+
public function getById(int $entityId): Data\PointInterface;
2832

2933
/**
3034
* Retrieve Point entities matching the specified criteria
3135
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
3236
* @throws \Magento\Framework\Exception\LocalizedException
3337
* @return \Mygento\Shipment\Api\Data\PointSearchResultsInterface
3438
*/
35-
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);
39+
public function getList(SearchCriteriaInterface $searchCriteria): Data\PointSearchResultsInterface;
3640

3741
/**
3842
* Delete Point
3943
* @param \Mygento\Shipment\Api\Data\PointInterface $entity
4044
* @throws \Magento\Framework\Exception\LocalizedException
4145
* @return bool true on success
4246
*/
43-
public function delete(Data\PointInterface $entity);
47+
public function delete(Data\PointInterface $entity): bool;
4448

4549
/**
4650
* Delete Point
47-
* @param int $entityId
4851
* @throws \Magento\Framework\Exception\NoSuchEntityException
4952
* @throws \Magento\Framework\Exception\LocalizedException
5053
* @return bool true on success
5154
*/
52-
public function deleteById($entityId);
55+
public function deleteById(int $entityId): bool;
5356
}

Controller/Adminhtml/Point.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ abstract class Point extends Action
2222
public const ADMIN_RESOURCE = 'Mygento_Shipment::point';
2323

2424
public function __construct(
25-
protected readonly PointRepositoryInterface $repository,
26-
protected readonly Registry $coreRegistry,
25+
protected PointRepositoryInterface $repository,
26+
protected Registry $coreRegistry,
2727
Action\Context $context,
2828
) {
2929
parent::__construct($context);

Controller/Adminhtml/Point/Index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
class Index extends Point
2020
{
2121
public function __construct(
22-
private readonly PageFactory $resultPageFactory,
23-
private readonly DataPersistorInterface $dataPersistor,
22+
private PageFactory $resultPageFactory,
23+
private DataPersistorInterface $dataPersistor,
2424
PointRepositoryInterface $repository,
2525
Registry $coreRegistry,
2626
Context $context,

Model/Point/DataProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
string $requestFieldName,
3131
array $meta = [],
3232
array $data = [],
33-
PoolInterface $pool = null,
33+
?PoolInterface $pool = null,
3434
) {
3535
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool);
3636

Model/PointRepository.php

Lines changed: 37 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -8,97 +8,73 @@
88

99
namespace Mygento\Shipment\Model;
1010

11+
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
12+
use Magento\Framework\Api\SearchCriteriaInterface;
13+
use Magento\Framework\Exception\CouldNotDeleteException;
14+
use Magento\Framework\Exception\CouldNotSaveException;
15+
use Magento\Framework\Exception\NoSuchEntityException;
16+
use Mygento\Shipment\Api\Data\PointInterface;
17+
use Mygento\Shipment\Api\Data\PointInterfaceFactory;
18+
use Mygento\Shipment\Api\Data\PointSearchResultsInterface;
19+
use Mygento\Shipment\Api\Data\PointSearchResultsInterfaceFactory;
20+
use Mygento\Shipment\Api\PointRepositoryInterface;
21+
use Mygento\Shipment\Model\ResourceModel\Point\CollectionFactory;
22+
1123
/**
1224
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1325
*/
14-
class PointRepository implements \Mygento\Shipment\Api\PointRepositoryInterface
26+
class PointRepository implements PointRepositoryInterface
1527
{
16-
/** @var \Mygento\Shipment\Model\ResourceModel\Point */
17-
private $resource;
18-
19-
/** @var \Mygento\Shipment\Model\ResourceModel\Point\CollectionFactory */
20-
private $collectionFactory;
21-
22-
/** @var \Mygento\Shipment\Api\Data\PointInterfaceFactory */
23-
private $entityFactory;
24-
25-
/** @var \Mygento\Shipment\Api\Data\PointSearchResultsInterfaceFactory */
26-
private $searchResultsFactory;
27-
28-
/**
29-
* @var \Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface
30-
*/
31-
private $collectionProcessor;
32-
33-
/**
34-
* PointRepository constructor.
35-
* @param ResourceModel\Point $resource
36-
* @param ResourceModel\Point\CollectionFactory $collectionFactory
37-
* @param \Mygento\Shipment\Api\Data\PointInterfaceFactory $entityFactory
38-
* @param \Mygento\Shipment\Api\Data\PointSearchResultsInterfaceFactory $searchResultsFactory
39-
* @param \Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface|null $collectionProcessor
40-
*/
4128
public function __construct(
42-
ResourceModel\Point $resource,
43-
ResourceModel\Point\CollectionFactory $collectionFactory,
44-
\Mygento\Shipment\Api\Data\PointInterfaceFactory $entityFactory,
45-
\Mygento\Shipment\Api\Data\PointSearchResultsInterfaceFactory $searchResultsFactory,
46-
\Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface $collectionProcessor = null,
47-
) {
48-
$this->resource = $resource;
49-
$this->collectionFactory = $collectionFactory;
50-
$this->entityFactory = $entityFactory;
51-
$this->searchResultsFactory = $searchResultsFactory;
52-
$this->collectionProcessor = $collectionProcessor;
53-
}
29+
private ResourceModel\Point $resource,
30+
private CollectionFactory $collectionFactory,
31+
private PointInterfaceFactory $entityFactory,
32+
private PointSearchResultsInterfaceFactory $searchResultsFactory,
33+
private CollectionProcessorInterface $collectionProcessor,
34+
) {}
5435

5536
/**
56-
* @param int $entityId
57-
* @throws \Magento\Framework\Exception\NoSuchEntityException
58-
* @return \Mygento\Shipment\Api\Data\PointInterface
37+
* @throws NoSuchEntityException
5938
*/
60-
public function getById($entityId)
39+
public function getById(int $entityId): PointInterface
6140
{
6241
$entity = $this->entityFactory->create();
6342
$this->resource->load($entity, $entityId);
6443
if (!$entity->getId()) {
65-
throw new \Magento\Framework\Exception\NoSuchEntityException(
66-
__('Shipment Point with id "%1" does not exist.', $entityId),
44+
throw new NoSuchEntityException(
45+
__('A Shipment Point with id "%1" does not exist', $entityId),
6746
);
6847
}
6948

7049
return $entity;
7150
}
7251

7352
/**
74-
* @param \Mygento\Shipment\Api\Data\PointInterface $entity
75-
* @throws \Magento\Framework\Exception\CouldNotSaveException
76-
* @return \Mygento\Shipment\Api\Data\PointInterface
53+
* @throws CouldNotSaveException
7754
*/
78-
public function save(\Mygento\Shipment\Api\Data\PointInterface $entity)
55+
public function save(PointInterface $entity): PointInterface
7956
{
8057
try {
8158
$this->resource->save($entity);
8259
} catch (\Exception $exception) {
83-
throw new \Magento\Framework\Exception\CouldNotSaveException(
84-
__($exception->getMessage()),
60+
throw new CouldNotSaveException(
61+
__('Could not save the Shipment Point'),
62+
$exception,
8563
);
8664
}
8765

8866
return $entity;
8967
}
9068

9169
/**
92-
* @param \Mygento\Shipment\Api\Data\PointInterface $entity
93-
* @throws \Magento\Framework\Exception\CouldNotDeleteException
94-
* @return bool
70+
* @throws CouldNotDeleteException
9571
*/
96-
public function delete(\Mygento\Shipment\Api\Data\PointInterface $entity)
72+
public function delete(PointInterface $entity): bool
9773
{
9874
try {
9975
$this->resource->delete($entity);
10076
} catch (\Exception $exception) {
101-
throw new \Magento\Framework\Exception\CouldNotDeleteException(
77+
throw new CouldNotDeleteException(
10278
__($exception->getMessage()),
10379
);
10480
}
@@ -107,30 +83,22 @@ public function delete(\Mygento\Shipment\Api\Data\PointInterface $entity)
10783
}
10884

10985
/**
110-
* @param int $entityId
111-
* @throws \Magento\Framework\Exception\NoSuchEntityException
112-
* @throws \Magento\Framework\Exception\CouldNotDeleteException
113-
* @return bool
86+
* @throws NoSuchEntityException
87+
* @throws CouldNotDeleteException
11488
*/
115-
public function deleteById($entityId)
89+
public function deleteById(int $entityId): bool
11690
{
11791
return $this->delete($this->getById($entityId));
11892
}
11993

120-
/**
121-
* @param \Magento\Framework\Api\SearchCriteriaInterface $criteria
122-
* @return \Mygento\Shipment\Api\Data\PointSearchResultsInterface
123-
*/
124-
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria)
94+
public function getList(SearchCriteriaInterface $criteria): PointSearchResultsInterface
12595
{
12696
/** @var \Mygento\Shipment\Model\ResourceModel\Point\Collection $collection */
12797
$collection = $this->collectionFactory->create();
12898

129-
if ($this->collectionProcessor) {
130-
$this->collectionProcessor->process($criteria, $collection);
131-
}
99+
$this->collectionProcessor->process($criteria, $collection);
132100

133-
/** @var \Mygento\Shipment\Api\Data\PointSearchResultsInterface $searchResults */
101+
/** @var PointSearchResultsInterface $searchResults */
134102
$searchResults = $this->searchResultsFactory->create();
135103
$searchResults->setSearchCriteria($criteria);
136104
$searchResults->setItems($collection->getItems());

Model/PointSearchResults.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
/**
4+
* @author Mygento Team
5+
* @copyright 2016-2025 Mygento (https://www.mygento.com)
6+
* @package Mygento_Shipment
7+
*/
8+
9+
namespace Mygento\Shipment\Model;
10+
11+
use Magento\Framework\Api\SearchResults;
12+
use Mygento\Shipment\Api\Data\PointSearchResultsInterface;
13+
14+
class PointSearchResults extends SearchResults implements PointSearchResultsInterface {}

Model/ResourceModel/Point/Grid/Collection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public function __construct(
3636
string $eventObject,
3737
string $resourceModel,
3838
string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class,
39-
AdapterInterface $connection = null,
40-
AbstractDb $resource = null,
39+
?AdapterInterface $connection = null,
40+
?AbstractDb $resource = null,
4141
) {
4242
parent::__construct(
4343
$entityFactory,
@@ -85,7 +85,7 @@ public function getSearchCriteria()
8585
* @return $this
8686
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
8787
*/
88-
public function setSearchCriteria(SearchCriteriaInterface $searchCriteria = null)
88+
public function setSearchCriteria(?SearchCriteriaInterface $searchCriteria = null)
8989
{
9090
return $this;
9191
}
@@ -113,7 +113,7 @@ public function setTotalCount($totalCount)
113113
* @return $this
114114
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
115115
*/
116-
public function setItems(array $items = null)
116+
public function setItems(?array $items = null)
117117
{
118118
return $this;
119119
}

0 commit comments

Comments
 (0)