@@ -58,6 +58,8 @@ class TagRepository implements TagRepositoryInterface
5858
5959 private $ collectionProcessor ;
6060
61+ protected $ _resource ;
62+
6163
6264 /**
6365 * @param ResourceTag $resource
@@ -79,9 +81,11 @@ public function __construct(
7981 DataObjectHelper $ dataObjectHelper ,
8082 DataObjectProcessor $ dataObjectProcessor ,
8183 StoreManagerInterface $ storeManager ,
82- CollectionProcessorInterface $ collectionProcessor
84+ CollectionProcessorInterface $ collectionProcessor ,
85+ \Magento \Framework \App \ResourceConnection $ Resource
8386 ) {
8487 $ this ->resource = $ resource ;
88+ $ this ->_resource = $ Resource ;
8589 $ this ->tagFactory = $ tagFactory ;
8690 $ this ->tagCollectionFactory = $ tagCollectionFactory ;
8791 $ this ->searchResultsFactory = $ searchResultsFactory ;
@@ -199,4 +203,22 @@ public function getByTagCode($tagCode){
199203 }
200204 return $ tagModel ->getDataModel ();
201205 }
206+ public function getListTag ($ args ){
207+ $ tagModel = $ this ->tagFactory ->create ();
208+ $ collection = $ tagModel ->getCollection ();
209+ $ collection ->addFieldToSelect ('* ' );
210+ if (isset ($ args ['tag_id ' ]) && $ args ['tag_id ' ]){
211+ $ collection ->addFieldToFilter ('tag_id ' , array ('eq ' => (int )$ args ['tag_id ' ]));
212+ }
213+ if (isset ($ args ['identifiers ' ]) && $ args ['identifiers ' ]){
214+ $ collection ->addFieldToFilter ('identifier ' , array ('like ' => "% {$ args ['identifiers ' ]}% " ));
215+ }
216+ if (isset ($ args ['tag_title ' ]) && $ args ['tag_title ' ]){
217+ $ collection ->addFieldToFilter ('tag_title ' , array ('like ' => "% {$ args ['tag_title ' ]}% " ));
218+ }
219+ if (isset ($ args ['status ' ]) && $ args ['status ' ]){
220+ $ collection ->addFieldToFilter ('status ' , array ('eq ' => $ args ['status ' ]));
221+ }
222+ return $ collection ;
223+ }
202224}
0 commit comments