@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | SearchResultsInterfaceFactory $searchResultsFactory, |
| 52 | 52 | ObjectManagerInterface $objectManager |
| 53 | 53 | ) { |
| 54 | - $this->object = $object; |
|
| 55 | - $this->collection = $collection; |
|
| 56 | - $this->searchResultsFactory = $searchResultsFactory; |
|
| 57 | - $this->objectManager = $objectManager; |
|
| 54 | + $this->object=$object; |
|
| 55 | + $this->collection=$collection; |
|
| 56 | + $this->searchResultsFactory=$searchResultsFactory; |
|
| 57 | + $this->objectManager=$objectManager; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function getById($id) |
| 77 | 77 | { |
| 78 | - $object = $this->objectManager->create($this->object); |
|
| 78 | + $object=$this->objectManager->create($this->object); |
|
| 79 | 79 | try { |
| 80 | 80 | $object->load($id); |
| 81 | 81 | if (!$object->getId()) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function getSingle(SearchCriteriaInterface $criteria) |
| 94 | 94 | { |
| 95 | - $list = $this->getList($criteria); |
|
| 95 | + $list=$this->getList($criteria); |
|
| 96 | 96 | return $list->getTotalCount() > 0 ? $list->getItems()[0] : null; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,23 +101,23 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function getList(SearchCriteriaInterface $criteria): SearchResultsInterface |
| 103 | 103 | { |
| 104 | - $searchResults = $this->searchResultsFactory->create(); |
|
| 104 | + $searchResults=$this->searchResultsFactory->create(); |
|
| 105 | 105 | $searchResults->setSearchCriteria($criteria); |
| 106 | - $collection = $this->objectManager->create($this->collection); |
|
| 106 | + $collection=$this->objectManager->create($this->collection); |
|
| 107 | 107 | foreach ($criteria->getFilterGroups() as $filterGroup) { |
| 108 | - $fields = []; |
|
| 109 | - $conditions = []; |
|
| 108 | + $fields=[]; |
|
| 109 | + $conditions=[]; |
|
| 110 | 110 | foreach ($filterGroup->getFilters() as $filter) { |
| 111 | - $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; |
|
| 112 | - $fields[] = $filter->getField(); |
|
| 113 | - $conditions[] = [$condition => $filter->getValue()]; |
|
| 111 | + $condition=$filter->getConditionType() ? $filter->getConditionType() : 'eq'; |
|
| 112 | + $fields[]=$filter->getField(); |
|
| 113 | + $conditions[]=[$condition => $filter->getValue()]; |
|
| 114 | 114 | } |
| 115 | 115 | if ($fields) { |
| 116 | 116 | $collection->addFieldToFilter($fields, $conditions); |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | $searchResults->setTotalCount($collection->getSize()); |
| 120 | - $sortOrders = $criteria->getSortOrders(); |
|
| 120 | + $sortOrders=$criteria->getSortOrders(); |
|
| 121 | 121 | if ($sortOrders) { |
| 122 | 122 | /** @var SortOrder $sortOrder */ |
| 123 | 123 | foreach ($sortOrders as $sortOrder) { |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | $collection->setCurPage($criteria->getCurrentPage()); |
| 131 | 131 | $collection->setPageSize($criteria->getPageSize()); |
| 132 | - $objects = []; |
|
| 132 | + $objects=[]; |
|
| 133 | 133 | foreach ($collection as $objectModel) { |
| 134 | - $objects[] = $objectModel; |
|
| 134 | + $objects[]=$objectModel; |
|
| 135 | 135 | } |
| 136 | 136 | $searchResults->setItems($objects); |
| 137 | 137 | return $searchResults; |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function delete($object): array |
| 146 | 146 | { |
| 147 | - $result = ['success' => true, 'message' => 'successfully deleted!!!']; |
|
| 147 | + $result=['success' => true, 'message' => 'successfully deleted!!!']; |
|
| 148 | 148 | try { |
| 149 | 149 | $object->delete(); |
| 150 | 150 | } catch (Throwable $exception) { |
| 151 | - $result = ['success' => false, 'message' => $exception->getMessage()]; |
|
| 151 | + $result=['success' => false, 'message' => $exception->getMessage()]; |
|
| 152 | 152 | } |
| 153 | 153 | return $result; |
| 154 | 154 | } |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function deleteById($id): array |
| 160 | 160 | { |
| 161 | - $object = $this->getById($id); |
|
| 162 | - $result = $this->delete($object); |
|
| 161 | + $object=$this->getById($id); |
|
| 162 | + $result=$this->delete($object); |
|
| 163 | 163 | return $result; |
| 164 | 164 | } |
| 165 | 165 | } |