Skip to content

Commit 0552334

Browse files
committed
MAGETWO-38296: [Add join processors to search service] UI Module
- Reverting join processor for UI module
1 parent 0b3ef05 commit 0552334

File tree

4 files changed

+27
-164
lines changed

4 files changed

+27
-164
lines changed

app/code/Magento/Ui/Api/Data/BookmarkInterface.php

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@
77

88
/**
99
* Bookmark page interface.
10-
*
1110
* @api
1211
*/
13-
interface BookmarkInterface extends \Magento\Framework\Api\ExtensibleDataInterface
12+
interface BookmarkInterface
1413
{
1514
/**#@+
1615
* Constants for keys of data array. Identical to the name of the getter in snake case
1716
*/
18-
const BOOKMARK_ID = 'bookmark_id';
19-
const USER_ID = 'user_id';
20-
const BOOKMARKSPACE = 'namespace';
21-
const IDENTIFIER = 'identifier';
22-
const TITLE = 'title';
23-
const CONFIG = 'config';
24-
const CREATED_AT = 'created_at';
25-
const UPDATED_AT = 'updated_at';
26-
const CURRENT = 'current';
17+
const BOOKMARK_ID = 'bookmark_id';
18+
const USER_ID = 'user_id';
19+
const BOOKMARKSPACE = 'namespace';
20+
const IDENTIFIER = 'identifier';
21+
const TITLE = 'title';
22+
const CONFIG = 'config';
23+
const CREATED_AT = 'created_at';
24+
const UPDATED_AT = 'updated_at';
25+
const CURRENT = 'current';
2726
/**#@-*/
2827

2928
/**
@@ -160,19 +159,4 @@ public function setUpdatedAt($updatedAt);
160159
* @return \Magento\Ui\Api\Data\BookmarkInterface
161160
*/
162161
public function setCurrent($isCurrent);
163-
164-
/**
165-
* Retrieve existing extension attributes object or create a new one.
166-
*
167-
* @return \Magento\Ui\Api\Data\BookmarkExtensionInterface|null
168-
*/
169-
public function getExtensionAttributes();
170-
171-
/**
172-
* Set an extension attributes object.
173-
*
174-
* @param \Magento\Ui\Api\Data\BookmarkExtensionInterface $extensionAttributes
175-
* @return $this
176-
*/
177-
public function setExtensionAttributes(\Magento\Ui\Api\Data\BookmarkExtensionInterface $extensionAttributes);
178162
}

app/code/Magento/Ui/Model/Bookmark.php

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@
55
*/
66
namespace Magento\Ui\Model;
77

8-
use Magento\Framework\Api\AttributeValueFactory;
98
use Magento\Framework\Json\Decoder;
109
use Magento\Framework\Json\Encoder;
10+
use Magento\Framework\Model\AbstractModel;
11+
use Magento\Framework\Model\Context;
12+
use Magento\Framework\Registry;
1113
use Magento\Ui\Api\Data\BookmarkInterface;
14+
use Magento\Ui\Model\Resource\Bookmark\Collection;
1215
use Magento\Ui\Model\Resource\Bookmark as ResourceBookmark;
1316

1417
/**
1518
* Domain class Bookmark
1619
*/
17-
class Bookmark extends \Magento\Framework\Model\AbstractExtensibleModel implements BookmarkInterface
20+
class Bookmark extends AbstractModel implements BookmarkInterface
1821
{
1922
/**
2023
* @var Encoder
@@ -27,48 +30,26 @@ class Bookmark extends \Magento\Framework\Model\AbstractExtensibleModel implemen
2730
protected $jsonDecoder;
2831

2932
/**
30-
* @param \Magento\Framework\Model\Context $context
31-
* @param \Magento\Framework\Registry $registry
32-
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
33-
* @param AttributeValueFactory $customAttributeFactory
3433
* @param Encoder $jsonEncoder
3534
* @param Decoder $jsonDecoder
36-
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
37-
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
35+
* @param Context $context
36+
* @param Registry $registry
37+
* @param ResourceBookmark $resource
38+
* @param Collection $resourceCollection
3839
* @param array $data
3940
*/
4041
public function __construct(
41-
\Magento\Framework\Model\Context $context,
42-
\Magento\Framework\Registry $registry,
43-
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
44-
AttributeValueFactory $customAttributeFactory,
42+
Context $context,
43+
Registry $registry,
44+
ResourceBookmark $resource,
45+
Collection $resourceCollection,
4546
Encoder $jsonEncoder,
4647
Decoder $jsonDecoder,
47-
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
48-
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
4948
array $data = []
5049
) {
5150
$this->jsonEncoder = $jsonEncoder;
5251
$this->jsonDecoder = $jsonDecoder;
53-
parent::__construct(
54-
$context,
55-
$registry,
56-
$extensionFactory,
57-
$customAttributeFactory,
58-
$resource,
59-
$resourceCollection,
60-
$data
61-
);
62-
}
63-
64-
/**
65-
* Initialize bookmark model
66-
*
67-
* @return void
68-
*/
69-
public function _construct()
70-
{
71-
$this->_init('Magento\Ui\Model\Resource\Bookmark');
52+
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
7253
}
7354

7455
/**
@@ -259,25 +240,4 @@ public function setUpdatedAt($updatedAt)
259240
{
260241
return $this->setData(self::UPDATED_AT, $updatedAt);
261242
}
262-
263-
/**
264-
* {@inheritdoc}
265-
*
266-
* @return \Magento\Ui\Api\Data\BookmarkExtensionInterface|null
267-
*/
268-
public function getExtensionAttributes()
269-
{
270-
return $this->_getExtensionAttributes();
271-
}
272-
273-
/**
274-
* {@inheritdoc}
275-
*
276-
* @param \Magento\Ui\Api\Data\BookmarkExtensionInterface $extensionAttributes
277-
* @return $this
278-
*/
279-
public function setExtensionAttributes(\Magento\Ui\Api\Data\BookmarkExtensionInterface $extensionAttributes)
280-
{
281-
return $this->_setExtensionAttributes($extensionAttributes);
282-
}
283243
}

app/code/Magento/Ui/Model/Resource/BookmarkRepository.php

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*/
66
namespace Magento\Ui\Model\Resource;
77

8-
use Magento\Ui\Model\Resource\Bookmark\CollectionFactory as BookmarkCollectionFactory;
9-
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
108
use Magento\Framework\Api\SearchCriteriaInterface;
119
use Magento\Ui\Api\BookmarkRepositoryInterface;
1210
use Magento\Framework\Api\Search\FilterGroup;
@@ -23,13 +21,6 @@
2321
*/
2422
class BookmarkRepository implements BookmarkRepositoryInterface
2523
{
26-
/**
27-
* Collection factory.
28-
*
29-
* @var BookmarkCollectionFactory
30-
*/
31-
private $collectionFactory;
32-
3324
/**
3425
* @var \Magento\Ui\Model\BookmarkFactory
3526
*/
@@ -46,29 +37,19 @@ class BookmarkRepository implements BookmarkRepositoryInterface
4637
protected $searchResultsFactory;
4738

4839
/**
49-
* @var JoinProcessorInterface
50-
*/
51-
private $extensionAttributesJoinProcessor;
52-
53-
/**
54-
* @param BookmarkCollectionFactory $collectionFactory Collection factory.
5540
* @param \Magento\Ui\Model\BookmarkFactory $bookmarkFactory
5641
* @param Bookmark $bookmarkResourceModel
5742
* @param \Magento\Ui\Api\Data\BookmarkSearchResultsInterfaceFactory $searchResultsFactory
58-
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
5943
*/
6044
public function __construct(
61-
BookmarkCollectionFactory $collectionFactory,
6245
\Magento\Ui\Model\BookmarkFactory $bookmarkFactory,
6346
\Magento\Ui\Model\Resource\Bookmark $bookmarkResourceModel,
64-
\Magento\Ui\Api\Data\BookmarkSearchResultsInterfaceFactory $searchResultsFactory,
65-
JoinProcessorInterface $extensionAttributesJoinProcessor
47+
\Magento\Ui\Api\Data\BookmarkSearchResultsInterfaceFactory $searchResultsFactory
6648
) {
67-
$this->collectionFactory = $collectionFactory;
49+
6850
$this->bookmarkResourceModel = $bookmarkResourceModel;
6951
$this->bookmarkFactory = $bookmarkFactory;
7052
$this->searchResultsFactory = $searchResultsFactory;
71-
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
7253
}
7354

7455
/**
@@ -118,8 +99,7 @@ public function getList(SearchCriteriaInterface $searchCriteria)
11899
$searchResults->setSearchCriteria($searchCriteria);
119100

120101
/** @var \Magento\Ui\Model\Resource\Bookmark\Collection $collection */
121-
$collection = $this->collectionFactory->create();
122-
$this->extensionAttributesJoinProcessor->process($collection);
102+
$collection = $this->bookmarkFactory->create()->getCollection();
123103
// Add filters from root filter group to the collection
124104
foreach ($searchCriteria->getFilterGroups() as $group) {
125105
$this->addFilterGroupToCollection($group, $collection);

dev/tests/integration/testsuite/Magento/Ui/Model/Resource/BookmarkRepositoryTest.php

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)