@@ -39,7 +39,6 @@ class TagRepository implements TagRepositoryInterface
3939
4040 private $ collectionProcessor ;
4141
42- protected $ extensibleDataObjectConverter ;
4342
4443 /**
4544 * @param ResourceTag $resource
@@ -51,8 +50,6 @@ class TagRepository implements TagRepositoryInterface
5150 * @param DataObjectProcessor $dataObjectProcessor
5251 * @param StoreManagerInterface $storeManager
5352 * @param CollectionProcessorInterface $collectionProcessor
54- * @param JoinProcessorInterface $extensionAttributesJoinProcessor
55- * @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
5653 */
5754 public function __construct (
5855 ResourceTag $ resource ,
@@ -63,9 +60,7 @@ public function __construct(
6360 DataObjectHelper $ dataObjectHelper ,
6461 DataObjectProcessor $ dataObjectProcessor ,
6562 StoreManagerInterface $ storeManager ,
66- CollectionProcessorInterface $ collectionProcessor ,
67- JoinProcessorInterface $ extensionAttributesJoinProcessor ,
68- ExtensibleDataObjectConverter $ extensibleDataObjectConverter
63+ CollectionProcessorInterface $ collectionProcessor
6964 ) {
7065 $ this ->resource = $ resource ;
7166 $ this ->tagFactory = $ tagFactory ;
@@ -76,8 +71,6 @@ public function __construct(
7671 $ this ->dataObjectProcessor = $ dataObjectProcessor ;
7772 $ this ->storeManager = $ storeManager ;
7873 $ this ->collectionProcessor = $ collectionProcessor ;
79- $ this ->extensionAttributesJoinProcessor = $ extensionAttributesJoinProcessor ;
80- $ this ->extensibleDataObjectConverter = $ extensibleDataObjectConverter ;
8174 }
8275
8376 /**
@@ -93,14 +86,14 @@ public function save($tagData){
9386 if ($ tagData ->getTagId ()){
9487 $ tagModel ->load ((int )$ tagData ->getTagId ());
9588 }
96- $ this -> resource -> save ( $ tagData );
89+ $ tagModel -> setData (( array ) $ tagData );
9790
9891 if ($ products = $ tagData ->getProducts ()) {
9992 $ tagModel ->setPostedProducts ($ products );
10093 }
10194
10295 try {
103- $ this -> resource -> save ( $ tagData );
96+ $ tagModel -> setData (( array ) $ tagData );
10497 } catch (\Exception $ exception ) {
10598 throw new CouldNotSaveException (__ (
10699 'Could not save the tag: %1 ' ,
@@ -130,23 +123,14 @@ public function getList(
130123 \Magento \Framework \Api \SearchCriteriaInterface $ criteria
131124 ) {
132125 $ collection = $ this ->tagCollectionFactory ->create ();
133-
134- $ this ->extensionAttributesJoinProcessor ->process (
135- $ collection ,
136- \Lof \ProductTags \Api \Data \TagInterface::class
137- );
138-
126+
139127 $ this ->collectionProcessor ->process ($ criteria , $ collection );
140-
128+ //$collection->load();
129+
141130 $ searchResults = $ this ->searchResultsFactory ->create ();
142131 $ searchResults ->setSearchCriteria ($ criteria );
143132
144- $ items = [];
145- foreach ($ collection as $ model ) {
146- $ items [] = $ model ->getDataModel ();
147- }
148-
149- $ searchResults ->setItems ($ items );
133+ $ searchResults ->setItems ($ collection ->getItems ());
150134 $ searchResults ->setTotalCount ($ collection ->getSize ());
151135 return $ searchResults ;
152136 }
@@ -157,7 +141,7 @@ public function getList(
157141 public function delete ($ tagId ) {
158142 try {
159143 $ tagModel = $ this ->tagFactory ->create ();
160- // secelt * from table where `tag_id` = $tagId
144+ // select * from table where `tag_id` = $tagId
161145 $ tagModel ->load ($ tagId );
162146 // $tagModel->getCollection()->addFieldToFilter('tag_id',$tagId);
163147 $ tagModel ->delete ();
0 commit comments