Completed
Branch master (72c774)
by dima
02:44
created
src/AbstractDataMapper.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	
54 54
 	/**
55 55
 	 * Cохранение сущности
56
-	 * @param \Core\Infrastructure\EntityInterface $Entity
56
+	 * @param EntityInterface $Entity
57 57
 	 */
58 58
 	public function save(EntityInterface $Entity)
59 59
 	{
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	
93 93
 	/**
94 94
 	 * из объекта формирует массив
95
-	 * @param \Core\Infrastructure\EntityInterface $Entity
95
+	 * @param EntityInterface $Entity
96 96
 	 * @return \Core\Infrastructure\EntityInterface
97 97
 	 * @throws BadMethodCallException
98 98
 	 */
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	/**
127 127
 	 * Подготавливаем конечный вариант Сущности
128 128
 	 * 
129
-	 * @param \Core\Infrastructure\EntityInterface $Entity
129
+	 * @param EntityInterface $Entity
130 130
 	 * @param array $row
131
-	 * @return \Core\Infrastructure\EntityInterface
131
+	 * @return EntityInterface
132 132
 	 * @throws BadMethodCallException
133 133
 	 */
134 134
 	protected function buildEntity(EntityInterface $Entity, array $row){
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	
173 173
 	/**
174 174
 	 * 
175
-	 * @param \Core\Infrastructure\ISpecificationCriteria $specification
175
+	 * @param ISpecificationCriteria $specification
176 176
 	 * @return type
177 177
 	 */
178 178
 	public function findBySpecification(ISpecificationCriteria $specification){
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	
196 196
 	/**
197 197
 	 * Удаление записи
198
-	 * @param \Core\Infrastructure\EntityInterface $Entity
198
+	 * @param EntityInterface $Entity
199 199
 	 * @return boolean
200 200
 	 */
201 201
 	public function delete(EntityInterface $Entity)
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	
250 250
 	/**
251 251
 	 * Выборка удаленных моделей
252
-	 * @param \Core\Infrastructure\ISpecificationCriteria $specification
252
+	 * @param ISpecificationCriteria $specification
253 253
 	 */
254 254
 	private function setSoftDelete(ISpecificationCriteria $specification){
255 255
 		if(
Please login to merge, or discard this patch.
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -112,8 +112,7 @@  discard block
 block discarded – undo
112 112
 			
113 113
 			if(method_exists($this, 'onUnBuild'.$propery )){
114 114
 				$value = $this->{'onUnBuild'.$propery}(  $Entity->{$method_get}() );
115
-			}
116
-			else{
115
+			} else{
117 116
 				$value = $Entity->{$method_get}();
118 117
 			}			
119 118
 			$row[$field] = $value;
@@ -148,13 +147,13 @@  discard block
 block discarded – undo
148 147
 			//событие onBuildField
149 148
 			if(method_exists($this, 'onBuild'.$propery )){
150 149
 				$value = $this->{'onBuild'.$propery}($field,$row);
151
-			}
152
-			elseif(is_string($field) && isset($row[strtolower($field)])){
150
+			} elseif(is_string($field) && isset($row[strtolower($field)])){
153 151
 				$value = $row[strtolower($field)];
154 152
 			}
155 153
 			
156
-			if($value!==false)
157
-				$Entity->{$method_set}($value);
154
+			if($value!==false) {
155
+							$Entity->{$method_set}($value);
156
+			}
158 157
 			
159 158
         }
160 159
 		
@@ -208,13 +207,13 @@  discard block
 block discarded – undo
208 207
 				$delete_key > '' && 
209 208
 				$Entity->getId() > 0){
210 209
 			$result = $this->db->update($this->getEntityTable(), [ $delete_key => 1 ], "{$this->setKey()} = '{$Entity->getId()}'");
211
-		}
212
-		elseif($Entity->getId() > 0){
210
+		} elseif($Entity->getId() > 0){
213 211
 			$result = $this->db->delete($this->getEntityTable(), [$this->setKey() => $Entity->getId()]);
214 212
 		}
215 213
 		
216
-		if($result===true)
217
-			unset($Entity);
214
+		if($result===true) {
215
+					unset($Entity);
216
+		}
218 217
 		
219 218
 		return $result;
220 219
 	}
@@ -255,8 +254,9 @@  discard block
 block discarded – undo
255 254
 		if(
256 255
 				$this->setSoftDeleteKey()>'' 
257 256
 				&& !isset($specification->getWhere()[$this->setSoftDeleteKey()])
258
-				)
259
-		$specification->setWhere($this->setSoftDeleteKey(),0);
257
+				) {
258
+				$specification->setWhere($this->setSoftDeleteKey(),0);
259
+		}
260 260
 	}
261 261
 	
262 262
 	/**
Please login to merge, or discard this patch.
src/AbstractOptDataMapper.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	/**
80 80
 	 * Подготавливаем конечный вариант Сущности
81 81
 	 * 
82
-	 * @param \Core\Infrastructure\EntityInterface $Entity
82
+	 * @param EntityInterface $Entity
83 83
 	 * @param array $row
84
-	 * @return \Core\Infrastructure\EntityInterface
84
+	 * @return EntityInterface
85 85
 	 * @throws BadMethodCallException
86 86
 	 */
87 87
 	protected function buildEntity(EntityInterface $Entity, array $row){
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	
132 132
 	/**
133 133
 	 * из объекта формирует массив
134
-	 * @param \Core\Infrastructure\EntityInterface $Entity
134
+	 * @param EntityInterface $Entity
135 135
 	 * @return \Core\Infrastructure\EntityInterface
136 136
 	 * @throws BadMethodCallException
137 137
 	 */
Please login to merge, or discard this patch.
Braces   +7 added lines, -10 removed lines patch added patch discarded remove patch
@@ -109,19 +109,18 @@  discard block
 block discarded – undo
109 109
 				
110 110
 				if($this->use_joins===true){
111 111
 					$value = $mapper->createEntity($row);
112
-				}
113
-				else{
112
+				} else{
114 113
 					$fkey = $mapper->key;
115 114
 					$value = $mapper->findBySpecification((new Specification)->setWhere($fkey, $row[$field]));
116 115
 				}				
117 116
 				
118
-			}
119
-			elseif(is_string($field) && isset($row[strtolower($field)])){
117
+			} elseif(is_string($field) && isset($row[strtolower($field)])){
120 118
 				$value = $row[strtolower($field)];
121 119
 			}
122 120
 			
123
-			if($value!==false)
124
-				$Entity->{$method_set}($value);
121
+			if($value!==false) {
122
+							$Entity->{$method_set}($value);
123
+			}
125 124
 			
126 125
         }
127 126
 		
@@ -152,13 +151,11 @@  discard block
 block discarded – undo
152 151
 			//--------------------------------------------------------------------
153 152
 			if( isset($cfg['unbuild']) && is_object($cfg['unbuild']) ){
154 153
 				$value = call_user_func($cfg['unbuild'], $Entity->{$method_get}() );
155
-			}
156
-			elseif(isset($cfg['relation'])){
154
+			} elseif(isset($cfg['relation'])){
157 155
 				
158 156
 				$value = $Entity->{$method_get}()->getId();
159 157
 				
160
-			}			
161
-			else{
158
+			} else{
162 159
 				$value = $Entity->{$method_get}();
163 160
 			}			
164 161
 			
Please login to merge, or discard this patch.
src/Specification.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,8 +77,7 @@
 block discarded – undo
77 77
     {
78 78
         if($value!==false){
79 79
             $this->where[$field] = $value;
80
-        }
81
-        else{
80
+        } else{
82 81
             $this->where = $where;
83 82
         }
84 83
         
Please login to merge, or discard this patch.