@@ -40,15 +40,15 @@ |
||
| 40 | 40 | LoggerInterface $logger, |
| 41 | 41 | FetchStrategyInterface $fetchStrategy, |
| 42 | 42 | ManagerInterface $eventManager, |
| 43 | - AdapterInterface $connection = null, |
|
| 44 | - AbstractDb $resource = null, |
|
| 43 | + AdapterInterface $connection=null, |
|
| 44 | + AbstractDb $resource=null, |
|
| 45 | 45 | string $idFieldName, |
| 46 | 46 | string $model, |
| 47 | 47 | string $resourceModel |
| 48 | 48 | ) { |
| 49 | - $this->_idFieldName = $idFieldName; |
|
| 50 | - $this->_model = $model; |
|
| 51 | - $this->_resourceModel = $resourceModel; |
|
| 49 | + $this->_idFieldName=$idFieldName; |
|
| 50 | + $this->_model=$model; |
|
| 51 | + $this->_resourceModel=$resourceModel; |
|
| 52 | 52 | parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -31,12 +31,12 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function __construct( |
| 33 | 33 | ParentContext $context, |
| 34 | - $connectionName = null, |
|
| 34 | + $connectionName=null, |
|
| 35 | 35 | string $tableName, |
| 36 | 36 | string $referenceId |
| 37 | 37 | ) { |
| 38 | - $this->tableName = $tableName; |
|
| 39 | - $this->referenceId = $referenceId; |
|
| 38 | + $this->tableName=$tableName; |
|
| 39 | + $this->referenceId=$referenceId; |
|
| 40 | 40 | parent::__construct($context, $connectionName); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | public function __construct( |
| 39 | 39 | Context $context, |
| 40 | 40 | Registry $registry, |
| 41 | - AbstractResource $resource = null, |
|
| 42 | - AbstractDb $resourceCollection = null, |
|
| 41 | + AbstractResource $resource=null, |
|
| 42 | + AbstractDb $resourceCollection=null, |
|
| 43 | 43 | string $resourceModelClass, |
| 44 | 44 | string $cacheTag, |
| 45 | - array $data = [] |
|
| 45 | + array $data=[] |
|
| 46 | 46 | ) { |
| 47 | - $this->resourceModelClass = $resourceModelClass; |
|
| 48 | - $this->cacheTag = $cacheTag; |
|
| 47 | + $this->resourceModelClass=$resourceModelClass; |
|
| 48 | + $this->cacheTag=$cacheTag; |
|
| 49 | 49 | parent::__construct($context, $registry, $resource, $resourceCollection, $data); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -56,6 +56,6 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function getIdentities() |
| 58 | 58 | { |
| 59 | - return [$this->cacheTag . '_' . $this->getId()]; |
|
| 59 | + return [$this->cacheTag.'_'.$this->getId()]; |
|
| 60 | 60 | } |
| 61 | 61 | } |
@@ -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 | } |