@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | ObjectManagerInterface $objectManager |
55 | 55 | ) { |
56 | 56 | |
57 | - $this->object = $object; |
|
58 | - $this->collection = $collection; |
|
59 | - $this->searchResultsFactory = $searchResultsFactory; |
|
60 | - $this->objectManager = $objectManager; |
|
57 | + $this->object=$object; |
|
58 | + $this->collection=$collection; |
|
59 | + $this->searchResultsFactory=$searchResultsFactory; |
|
60 | + $this->objectManager=$objectManager; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getById($id) |
80 | 80 | { |
81 | - $object = $this->objectManager->create($this->object); |
|
81 | + $object=$this->objectManager->create($this->object); |
|
82 | 82 | try { |
83 | 83 | $object->load($id); |
84 | 84 | if (!$object->getId()) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getSingle(SearchCriteriaInterface $criteria) |
97 | 97 | { |
98 | - $list = $this->getList($criteria); |
|
98 | + $list=$this->getList($criteria); |
|
99 | 99 | return $list->getTotalCount() > 0 ? $list->getItems()[0] : null; |
100 | 100 | } |
101 | 101 | |
@@ -104,23 +104,23 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getList(SearchCriteriaInterface $criteria): SearchResultsInterface |
106 | 106 | { |
107 | - $searchResults = $this->searchResultsFactory->create(); |
|
107 | + $searchResults=$this->searchResultsFactory->create(); |
|
108 | 108 | $searchResults->setSearchCriteria($criteria); |
109 | - $collection = $this->objectManager->create($this->collection); |
|
109 | + $collection=$this->objectManager->create($this->collection); |
|
110 | 110 | foreach ($criteria->getFilterGroups() as $filterGroup) { |
111 | - $fields = []; |
|
112 | - $conditions = []; |
|
111 | + $fields=[]; |
|
112 | + $conditions=[]; |
|
113 | 113 | foreach ($filterGroup->getFilters() as $filter) { |
114 | - $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; |
|
115 | - $fields[] = $filter->getField(); |
|
116 | - $conditions[] = [$condition => $filter->getValue()]; |
|
114 | + $condition=$filter->getConditionType() ? $filter->getConditionType() : 'eq'; |
|
115 | + $fields[]=$filter->getField(); |
|
116 | + $conditions[]=[$condition => $filter->getValue()]; |
|
117 | 117 | } |
118 | 118 | if ($fields) { |
119 | 119 | $collection->addFieldToFilter($fields, $conditions); |
120 | 120 | } |
121 | 121 | } |
122 | 122 | $searchResults->setTotalCount($collection->getSize()); |
123 | - $sortOrders = $criteria->getSortOrders(); |
|
123 | + $sortOrders=$criteria->getSortOrders(); |
|
124 | 124 | if ($sortOrders) { |
125 | 125 | /** @var SortOrder $sortOrder */ |
126 | 126 | foreach ($sortOrders as $sortOrder) { |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | } |
133 | 133 | $collection->setCurPage($criteria->getCurrentPage()); |
134 | 134 | $collection->setPageSize($criteria->getPageSize()); |
135 | - $objects = []; |
|
135 | + $objects=[]; |
|
136 | 136 | foreach ($collection as $objectModel) { |
137 | - $objects[] = $objectModel; |
|
137 | + $objects[]=$objectModel; |
|
138 | 138 | } |
139 | 139 | $searchResults->setItems($objects); |
140 | 140 | return $searchResults; |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function delete($object): array |
149 | 149 | { |
150 | - $result = ['success' => true, 'message' => 'successfully deleted!!!']; |
|
150 | + $result=['success' => true, 'message' => 'successfully deleted!!!']; |
|
151 | 151 | try { |
152 | 152 | $object->delete(); |
153 | 153 | } catch (Throwable $exception) { |
154 | - $result = ['success' => false, 'message' => $exception->getMessage()]; |
|
154 | + $result=['success' => false, 'message' => $exception->getMessage()]; |
|
155 | 155 | } |
156 | 156 | return $result; |
157 | 157 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function deleteById($id): array |
163 | 163 | { |
164 | - $object = $this->getById($id); |
|
165 | - $result = $this->delete($object); |
|
164 | + $object=$this->getById($id); |
|
165 | + $result=$this->delete($object); |
|
166 | 166 | return $result; |
167 | 167 | } |
168 | 168 | } |