@@ -53,7 +53,7 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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(  | 
                                                        
@@ -11,7 +11,7 @@ discard block  | 
                                                    ||
| 11 | 11 |  { | 
                                                        
| 12 | 12 | protected $db;  | 
                                                        
| 13 | 13 | |
| 14 | - protected $entityTable;  | 
                                                        |
| 14 | + protected $entityTable;  | 
                                                        |
| 15 | 15 | |
| 16 | 16 | protected $key;  | 
                                                        
| 17 | 17 | |
@@ -23,7 +23,7 @@ discard block  | 
                                                    ||
| 23 | 23 | protected $use_joins = false;  | 
                                                        
| 24 | 24 | |
| 25 | 25 |  	public function __construct( QueryBuilderInterface $adapter, $db_name = null) {// \CI_DB_mysqli_driver //DatabaseAdapterInterface | 
                                                        
| 26 | - $this->db = $adapter;  | 
                                                        |
| 26 | + $this->db = $adapter;  | 
                                                        |
| 27 | 27 | |
| 28 | 28 | $this->entityTable = !empty($db_name)? "$db_name.".$this->setEntityTable() : $this->setEntityTable();  | 
                                                        
| 29 | 29 | |
@@ -32,7 +32,7 @@ discard block  | 
                                                    ||
| 32 | 32 |  		if($this->getEntityTable()=='' || $this->getPrimaryKey()==''){ | 
                                                        
| 33 | 33 |  			throw new InvalidEntityPropertyException('Свойства entityTable или key не заданы'); | 
                                                        
| 34 | 34 | }  | 
                                                        
| 35 | - }  | 
                                                        |
| 35 | + }  | 
                                                        |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
@@ -40,16 +40,16 @@ discard block  | 
                                                    ||
| 40 | 40 | return $this->entityTable;  | 
                                                        
| 41 | 41 | }  | 
                                                        
| 42 | 42 | |
| 43 | -    public function getAdapter() { | 
                                                        |
| 44 | - return $this->db;  | 
                                                        |
| 45 | - }  | 
                                                        |
| 43 | +	public function getAdapter() { | 
                                                        |
| 44 | + return $this->db;  | 
                                                        |
| 45 | + }  | 
                                                        |
| 46 | 46 | |
| 47 | - public function findById($id)  | 
                                                        |
| 48 | -    { | 
                                                        |
| 47 | + public function findById($id)  | 
                                                        |
| 48 | +	{ | 
                                                        |
| 49 | 49 | $Criteria = (new Specification())->setWhere($this->key , $id);  | 
                                                        
| 50 | 50 | |
| 51 | - return $this->findBySpecification($Criteria);  | 
                                                        |
| 52 | - }  | 
                                                        |
| 51 | + return $this->findBySpecification($Criteria);  | 
                                                        |
| 52 | + }  | 
                                                        |
| 53 | 53 | |
| 54 | 54 | /**  | 
                                                        
| 55 | 55 | * Cохранение сущности  | 
                                                        
@@ -102,7 +102,7 @@ discard block  | 
                                                    ||
| 102 | 102 | |
| 103 | 103 | $row = [];  | 
                                                        
| 104 | 104 | |
| 105 | -        foreach ($mapfileds as $propery => $field ) { | 
                                                        |
| 105 | +		foreach ($mapfileds as $propery => $field ) { | 
                                                        |
| 106 | 106 | |
| 107 | 107 | $method_get = 'get' . ucfirst($propery);  | 
                                                        
| 108 | 108 | |
@@ -118,9 +118,9 @@ discard block  | 
                                                    ||
| 118 | 118 | }  | 
                                                        
| 119 | 119 | $row[$field] = $value;  | 
                                                        
| 120 | 120 | |
| 121 | - }  | 
                                                        |
| 121 | + }  | 
                                                        |
| 122 | 122 | |
| 123 | - return $row;  | 
                                                        |
| 123 | + return $row;  | 
                                                        |
| 124 | 124 | }  | 
                                                        
| 125 | 125 | |
| 126 | 126 | /**  | 
                                                        
@@ -135,7 +135,7 @@ discard block  | 
                                                    ||
| 135 | 135 | |
| 136 | 136 | $mapfields = array_merge([ 'id' => $this->key], $this->setMappingFields());  | 
                                                        
| 137 | 137 | |
| 138 | -        foreach ($mapfields as $propery => $field ) { | 
                                                        |
| 138 | +		foreach ($mapfields as $propery => $field ) { | 
                                                        |
| 139 | 139 | |
| 140 | 140 | $value = false;  | 
                                                        
| 141 | 141 | |
@@ -156,9 +156,9 @@ discard block  | 
                                                    ||
| 156 | 156 | if($value!==false)  | 
                                                        
| 157 | 157 |  				$Entity->{$method_set}($value); | 
                                                        
| 158 | 158 | |
| 159 | - }  | 
                                                        |
| 159 | + }  | 
                                                        |
| 160 | 160 | |
| 161 | - return $Entity;  | 
                                                        |
| 161 | + return $Entity;  | 
                                                        |
| 162 | 162 | }  | 
                                                        
| 163 | 163 | |
| 164 | 164 | |
@@ -187,10 +187,10 @@ discard block  | 
                                                    ||
| 187 | 187 | //получение записей  | 
                                                        
| 188 | 188 | $res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification);  | 
                                                        
| 189 | 189 | |
| 190 | -        if (!$row = $res->row_array()) { | 
                                                        |
| 191 | - return null;  | 
                                                        |
| 192 | - }  | 
                                                        |
| 193 | - return $this->createEntity($row);  | 
                                                        |
| 190 | +		if (!$row = $res->row_array()) { | 
                                                        |
| 191 | + return null;  | 
                                                        |
| 192 | + }  | 
                                                        |
| 193 | + return $this->createEntity($row);  | 
                                                        |
| 194 | 194 | }  | 
                                                        
| 195 | 195 | |
| 196 | 196 | /**  | 
                                                        
@@ -232,8 +232,8 @@ discard block  | 
                                                    ||
| 232 | 232 | $res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification);  | 
                                                        
| 233 | 233 | |
| 234 | 234 |  		if (!$rows = $res->result_array()) { | 
                                                        
| 235 | - return null;  | 
                                                        |
| 236 | - }  | 
                                                        |
| 235 | + return null;  | 
                                                        |
| 236 | + }  | 
                                                        |
| 237 | 237 | |
| 238 | 238 |  		foreach($rows as $k =>  $row){ | 
                                                        
| 239 | 239 | $rows[$k] = $this->createEntity($row);  | 
                                                        
@@ -110,8 +110,7 @@ discard block  | 
                                                    ||
| 110 | 110 | |
| 111 | 111 |  			if(method_exists($this, 'onUnBuild'.$propery )){ | 
                                                        
| 112 | 112 |  				$value = $this->{'onUnBuild'.$propery}(  $Entity->{$method_get}() ); | 
                                                        
| 113 | - }  | 
                                                        |
| 114 | -			else{ | 
                                                        |
| 113 | +			} else{ | 
                                                        |
| 115 | 114 |  				$value = $Entity->{$method_get}(); | 
                                                        
| 116 | 115 | }  | 
                                                        
| 117 | 116 | $row[$field] = $value;  | 
                                                        
@@ -146,13 +145,13 @@ discard block  | 
                                                    ||
| 146 | 145 | //событие onBuildField  | 
                                                        
| 147 | 146 |  			if(method_exists($this, 'onBuild'.$propery )){ | 
                                                        
| 148 | 147 |  				$value = $this->{'onBuild'.$propery}($field,$row); | 
                                                        
| 149 | - }  | 
                                                        |
| 150 | -			elseif(is_string($field) && isset($row[strtolower($field)])){ | 
                                                        |
| 148 | +			} elseif(is_string($field) && isset($row[strtolower($field)])){ | 
                                                        |
| 151 | 149 | $value = $row[strtolower($field)];  | 
                                                        
| 152 | 150 | }  | 
                                                        
| 153 | 151 | |
| 154 | - if($value!==false)  | 
                                                        |
| 155 | -				$Entity->{$method_set}($value); | 
                                                        |
| 152 | +			if($value!==false) { | 
                                                        |
| 153 | +							$Entity->{$method_set}($value); | 
                                                        |
| 154 | + }  | 
                                                        |
| 156 | 155 | |
| 157 | 156 | }  | 
                                                        
| 158 | 157 | |
@@ -206,8 +205,7 @@ discard block  | 
                                                    ||
| 206 | 205 | $delete_key > '' &&  | 
                                                        
| 207 | 206 |  				$Entity->getId() > 0){ | 
                                                        
| 208 | 207 |  				$result = $this->db->update($this->getEntityTable(), [ $delete_key => 1 ], "{$this->getPrimaryKey()} = '{$Entity->getId()}'"); | 
                                                        
| 209 | - }  | 
                                                        |
| 210 | -		elseif($Entity->getId() > 0){ | 
                                                        |
| 208 | +		} elseif($Entity->getId() > 0){ | 
                                                        |
| 211 | 209 | |
| 212 | 210 |  			if($result = $this->db->delete($this->getEntityTable(), $this->getPrimaryKey()."  = ".$Entity->getId())){ | 
                                                        
| 213 | 211 |  				if(method_exists($this, 'onDeleteSuccess' )){ $result = $this->onDeleteSuccess( $Entity );} | 
                                                        
@@ -253,8 +251,9 @@ discard block  | 
                                                    ||
| 253 | 251 | if(  | 
                                                        
| 254 | 252 | $this->setSoftDeleteKey()>''  | 
                                                        
| 255 | 253 | && !isset($specification->getWhere()[$this->setSoftDeleteKey()])  | 
                                                        
| 256 | - )  | 
                                                        |
| 257 | - $specification->setWhere($this->setSoftDeleteKey(),0);  | 
                                                        |
| 254 | +				) { | 
                                                        |
| 255 | + $specification->setWhere($this->setSoftDeleteKey(),0);  | 
                                                        |
| 256 | + }  | 
                                                        |
| 258 | 257 | }  | 
                                                        
| 259 | 258 | |
| 260 | 259 | /**  | 
                                                        
@@ -24,14 +24,14 @@ discard block  | 
                                                    ||
| 24 | 24 | |
| 25 | 25 | protected $use_delete = false;  | 
                                                        
| 26 | 26 | |
| 27 | -	public function __construct( QueryBuilderInterface $adapter, $db_name = null) {// \CI_DB_mysqli_driver //DatabaseAdapterInterface | 
                                                        |
| 27 | +	public function __construct(QueryBuilderInterface $adapter, $db_name = null) {// \CI_DB_mysqli_driver //DatabaseAdapterInterface | 
                                                        |
| 28 | 28 | $this->db = $adapter;  | 
                                                        
| 29 | 29 | |
| 30 | - $this->entityTable = !empty($db_name)? "$db_name.".$this->setEntityTable() : $this->setEntityTable();  | 
                                                        |
| 30 | + $this->entityTable = !empty($db_name) ? "$db_name.".$this->setEntityTable() : $this->setEntityTable();  | 
                                                        |
| 31 | 31 | |
| 32 | 32 | //$this->key = $this->getKey();  | 
                                                        
| 33 | 33 | |
| 34 | -		if($this->getEntityTable()=='' || $this->getPrimaryKey()==''){ | 
                                                        |
| 34 | +		if ($this->getEntityTable()=='' || $this->getPrimaryKey()=='') { | 
                                                        |
| 35 | 35 |  			throw new InvalidEntityPropertyException('Свойства entityTable или key не заданы'); | 
                                                        
| 36 | 36 | }  | 
                                                        
| 37 | 37 | }  | 
                                                        
@@ -48,7 +48,7 @@ discard block  | 
                                                    ||
| 48 | 48 | |
| 49 | 49 | public function findById($id)  | 
                                                        
| 50 | 50 |      { | 
                                                        
| 51 | - $Criteria = (new Specification())->setWhere($this->key , $id);  | 
                                                        |
| 51 | + $Criteria = (new Specification())->setWhere($this->key, $id);  | 
                                                        |
| 52 | 52 | |
| 53 | 53 | return $this->findBySpecification($Criteria);  | 
                                                        
| 54 | 54 | }  | 
                                                        
@@ -70,7 +70,7 @@ discard block  | 
                                                    ||
| 70 | 70 | |
| 71 | 71 | unset($data[$this->setSoftDeleteKey()]);  | 
                                                        
| 72 | 72 | |
| 73 | - $this->db->insert($this->getEntityTable(),$data);  | 
                                                        |
| 73 | + $this->db->insert($this->getEntityTable(), $data);  | 
                                                        |
| 74 | 74 | |
| 75 | 75 |  			if (!$id = $this->db->insert_id()) { | 
                                                        
| 76 | 76 | return false;  | 
                                                        
@@ -81,13 +81,13 @@ discard block  | 
                                                    ||
| 81 | 81 | //update  | 
                                                        
| 82 | 82 |  		else { | 
                                                        
| 83 | 83 | |
| 84 | -			if(!$this->getAdapter()->update($this->getEntityTable(), $data, "{$this->getPrimaryKey()} = '{$id}'")){ | 
                                                        |
| 84 | +			if (!$this->getAdapter()->update($this->getEntityTable(), $data, "{$this->getPrimaryKey()} = '{$id}'")) { | 
                                                        |
| 85 | 85 | return false;  | 
                                                        
| 86 | 86 | }  | 
                                                        
| 87 | 87 | |
| 88 | 88 | }  | 
                                                        
| 89 | 89 | |
| 90 | -		if(method_exists($this, 'onSaveSuccess' )){ return $this->onSaveSuccess( $Entity );} | 
                                                        |
| 90 | +		if (method_exists($this, 'onSaveSuccess')) { return $this->onSaveSuccess($Entity); } | 
                                                        |
| 91 | 91 | |
| 92 | 92 | return true;  | 
                                                        
| 93 | 93 | }  | 
                                                        
@@ -98,24 +98,24 @@ discard block  | 
                                                    ||
| 98 | 98 | * @return \Core\Infrastructure\EntityInterface  | 
                                                        
| 99 | 99 | * @throws BadMethodCallException  | 
                                                        
| 100 | 100 | */  | 
                                                        
| 101 | -	protected function unbuildEntity(EntityInterface $Entity){ | 
                                                        |
| 101 | +	protected function unbuildEntity(EntityInterface $Entity) { | 
                                                        |
| 102 | 102 | |
| 103 | - $mapfileds = array_merge([ 'id' => $this->key], $this->setMappingFields());  | 
                                                        |
| 103 | + $mapfileds = array_merge(['id' => $this->key], $this->setMappingFields());  | 
                                                        |
| 104 | 104 | |
| 105 | 105 | $row = [];  | 
                                                        
| 106 | 106 | |
| 107 | -        foreach ($mapfileds as $propery => $field ) { | 
                                                        |
| 107 | +        foreach ($mapfileds as $propery => $field) { | 
                                                        |
| 108 | 108 | |
| 109 | - $method_get = 'get' . ucfirst($propery);  | 
                                                        |
| 109 | + $method_get = 'get'.ucfirst($propery);  | 
                                                        |
| 110 | 110 | |
| 111 | -			if(!method_exists($Entity, $method_get )){ | 
                                                        |
| 111 | +			if (!method_exists($Entity, $method_get)) { | 
                                                        |
| 112 | 112 |  				throw new BadMethodCallException("Метод {$method_get}  не определен"); | 
                                                        
| 113 | 113 | }  | 
                                                        
| 114 | 114 | |
| 115 | -			if(method_exists($this, 'onUnBuild'.$propery )){ | 
                                                        |
| 116 | -				$value = $this->{'onUnBuild'.$propery}(  $Entity->{$method_get}() ); | 
                                                        |
| 115 | +			if (method_exists($this, 'onUnBuild'.$propery)) { | 
                                                        |
| 116 | +				$value = $this->{'onUnBuild'.$propery}($Entity->{$method_get}()); | 
                                                        |
| 117 | 117 | }  | 
                                                        
| 118 | -			else{ | 
                                                        |
| 118 | +			else { | 
                                                        |
| 119 | 119 |  				$value = $Entity->{$method_get}(); | 
                                                        
| 120 | 120 | }  | 
                                                        
| 121 | 121 | $row[$field] = $value;  | 
                                                        
@@ -133,29 +133,29 @@ discard block  | 
                                                    ||
| 133 | 133 | * @return \Core\Infrastructure\EntityInterface  | 
                                                        
| 134 | 134 | * @throws BadMethodCallException  | 
                                                        
| 135 | 135 | */  | 
                                                        
| 136 | -	protected function buildEntity(EntityInterface $Entity, array $row){ | 
                                                        |
| 136 | +	protected function buildEntity(EntityInterface $Entity, array $row) { | 
                                                        |
| 137 | 137 | |
| 138 | - $mapfields = array_merge([ 'id' => $this->key], $this->setMappingFields());  | 
                                                        |
| 138 | + $mapfields = array_merge(['id' => $this->key], $this->setMappingFields());  | 
                                                        |
| 139 | 139 | |
| 140 | -        foreach ($mapfields as $propery => $field ) { | 
                                                        |
| 140 | +        foreach ($mapfields as $propery => $field) { | 
                                                        |
| 141 | 141 | |
| 142 | 142 | $value = false;  | 
                                                        
| 143 | 143 | |
| 144 | - $method_set = 'set' . ucfirst($propery);  | 
                                                        |
| 144 | + $method_set = 'set'.ucfirst($propery);  | 
                                                        |
| 145 | 145 | |
| 146 | -			if(!method_exists($Entity, $method_set )){ | 
                                                        |
| 146 | +			if (!method_exists($Entity, $method_set)) { | 
                                                        |
| 147 | 147 |  				throw new BadMethodCallException("Метод {$method_set}  не определен"); | 
                                                        
| 148 | 148 | }  | 
                                                        
| 149 | 149 | |
| 150 | 150 | //событие onBuildField  | 
                                                        
| 151 | -			if(method_exists($this, 'onBuild'.$propery )){ | 
                                                        |
| 152 | -				$value = $this->{'onBuild'.$propery}($field,$row); | 
                                                        |
| 151 | +			if (method_exists($this, 'onBuild'.$propery)) { | 
                                                        |
| 152 | +				$value = $this->{'onBuild'.$propery}($field, $row); | 
                                                        |
| 153 | 153 | }  | 
                                                        
| 154 | -			elseif(is_string($field) && isset($row[strtolower($field)])){ | 
                                                        |
| 154 | +			elseif (is_string($field) && isset($row[strtolower($field)])) { | 
                                                        |
| 155 | 155 | $value = $row[strtolower($field)];  | 
                                                        
| 156 | 156 | }  | 
                                                        
| 157 | 157 | |
| 158 | - if($value!==false)  | 
                                                        |
| 158 | + if ($value!==false)  | 
                                                        |
| 159 | 159 |  				$Entity->{$method_set}($value); | 
                                                        
| 160 | 160 | |
| 161 | 161 | }  | 
                                                        
@@ -177,7 +177,7 @@ discard block  | 
                                                    ||
| 177 | 177 | * @param \Core\Infrastructure\ISpecificationCriteria $specification  | 
                                                        
| 178 | 178 | * @return type  | 
                                                        
| 179 | 179 | */  | 
                                                        
| 180 | -	public function findBySpecification(ISpecificationCriteria $specification){ | 
                                                        |
| 180 | +	public function findBySpecification(ISpecificationCriteria $specification) { | 
                                                        |
| 181 | 181 | |
| 182 | 182 | //псеводо удаление  | 
                                                        
| 183 | 183 | $this->setSoftDelete($specification);  | 
                                                        
@@ -187,7 +187,7 @@ discard block  | 
                                                    ||
| 187 | 187 | $specification->setLimit(1);  | 
                                                        
| 188 | 188 | |
| 189 | 189 | //получение записей  | 
                                                        
| 190 | - $res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification);  | 
                                                        |
| 190 | + $res = $this->getAdapter()->getResultQuery($this->getEntityTable(), $specification);  | 
                                                        |
| 191 | 191 | |
| 192 | 192 |          if (!$row = $res->row_array()) { | 
                                                        
| 193 | 193 | return null;  | 
                                                        
@@ -208,13 +208,13 @@ discard block  | 
                                                    ||
| 208 | 208 | |
| 209 | 209 | if (  | 
                                                        
| 210 | 210 | $delete_key > '' &&  | 
                                                        
| 211 | -				$Entity->getId() > 0){ | 
                                                        |
| 212 | -				$result = $this->db->update($this->getEntityTable(), [ $delete_key => 1 ], "{$this->getPrimaryKey()} = '{$Entity->getId()}'"); | 
                                                        |
| 211 | +				$Entity->getId() > 0) { | 
                                                        |
| 212 | +				$result = $this->db->update($this->getEntityTable(), [$delete_key => 1], "{$this->getPrimaryKey()} = '{$Entity->getId()}'"); | 
                                                        |
| 213 | 213 | }  | 
                                                        
| 214 | -		elseif($Entity->getId() > 0){ | 
                                                        |
| 214 | +		elseif ($Entity->getId() > 0) { | 
                                                        |
| 215 | 215 | |
| 216 | -			if($result = $this->db->delete($this->getEntityTable(), $this->getPrimaryKey()."  = ".$Entity->getId())){ | 
                                                        |
| 217 | -				if(method_exists($this, 'onDeleteSuccess' )){ $result = $this->onDeleteSuccess( $Entity );} | 
                                                        |
| 216 | +			if ($result = $this->db->delete($this->getEntityTable(), $this->getPrimaryKey()."  = ".$Entity->getId())) { | 
                                                        |
| 217 | +				if (method_exists($this, 'onDeleteSuccess')) { $result = $this->onDeleteSuccess($Entity); } | 
                                                        |
| 218 | 218 | }  | 
                                                        
| 219 | 219 | }  | 
                                                        
| 220 | 220 | |
@@ -231,13 +231,13 @@ discard block  | 
                                                    ||
| 231 | 231 | |
| 232 | 232 | $this->setRelations($specification);  | 
                                                        
| 233 | 233 | |
| 234 | - $res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification);  | 
                                                        |
| 234 | + $res = $this->getAdapter()->getResultQuery($this->getEntityTable(), $specification);  | 
                                                        |
| 235 | 235 | |
| 236 | 236 |  		if (!$rows = $res->result_array()) { | 
                                                        
| 237 | 237 | return null;  | 
                                                        
| 238 | 238 | }  | 
                                                        
| 239 | 239 | |
| 240 | -		foreach($rows as $k =>  $row){ | 
                                                        |
| 240 | +		foreach ($rows as $k =>  $row) { | 
                                                        |
| 241 | 241 | $rows[$k] = $this->createEntity($row);  | 
                                                        
| 242 | 242 | }  | 
                                                        
| 243 | 243 | |
@@ -253,23 +253,23 @@ discard block  | 
                                                    ||
| 253 | 253 | * Выборка удаленных моделей  | 
                                                        
| 254 | 254 | * @param \Core\Infrastructure\ISpecificationCriteria $specification  | 
                                                        
| 255 | 255 | */  | 
                                                        
| 256 | -	private function setSoftDelete(ISpecificationCriteria $specification){ | 
                                                        |
| 257 | - if(  | 
                                                        |
| 258 | - $this->use_delete === false &&  | 
                                                        |
| 259 | - $this->setSoftDeleteKey()>''  | 
                                                        |
| 256 | +	private function setSoftDelete(ISpecificationCriteria $specification) { | 
                                                        |
| 257 | + if (  | 
                                                        |
| 258 | + $this->use_delete===false &&  | 
                                                        |
| 259 | + $this->setSoftDeleteKey() > ''  | 
                                                        |
| 260 | 260 | && !isset($specification->getWhere()[$this->setSoftDeleteKey()])  | 
                                                        
| 261 | 261 | )  | 
                                                        
| 262 | - $specification->setWhere($this->setSoftDeleteKey(),0);  | 
                                                        |
| 262 | + $specification->setWhere($this->setSoftDeleteKey(), 0);  | 
                                                        |
| 263 | 263 | }  | 
                                                        
| 264 | 264 | |
| 265 | 265 | /**  | 
                                                        
| 266 | 266 | * Построение join-ов  | 
                                                        
| 267 | 267 | */  | 
                                                        
| 268 | -	protected function setRelations(ISpecificationCriteria $Specification){ | 
                                                        |
| 269 | -		if($this->use_joins===true){ | 
                                                        |
| 268 | +	protected function setRelations(ISpecificationCriteria $Specification) { | 
                                                        |
| 269 | +		if ($this->use_joins===true) { | 
                                                        |
| 270 | 270 | $joins = [];  | 
                                                        
| 271 | 271 | |
| 272 | -			foreach($this->setJoins() as $join){ | 
                                                        |
| 272 | +			foreach ($this->setJoins() as $join) { | 
                                                        |
| 273 | 273 | $table = (new $join['mapper']($this->getAdapter()))->setEntityTable();  | 
                                                        
| 274 | 274 | |
| 275 | 275 | $joins[$table] = $join;  | 
                                                        
@@ -290,7 +290,7 @@ discard block  | 
                                                    ||
| 290 | 290 | return $o;  | 
                                                        
| 291 | 291 | }  | 
                                                        
| 292 | 292 | |
| 293 | -	public function withDelete(){ | 
                                                        |
| 293 | +	public function withDelete() { | 
                                                        |
| 294 | 294 | $o = clone $this;  | 
                                                        
| 295 | 295 | $o->use_delete = true;  | 
                                                        
| 296 | 296 | return $o;  | 
                                                        
@@ -79,9 +79,9 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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 | */  | 
                                                        
@@ -95,7 +95,7 @@ discard block  | 
                                                    ||
| 95 | 95 | */  | 
                                                        
| 96 | 96 |  	protected function buildEntity(EntityInterface $Entity, array $row){ | 
                                                        
| 97 | 97 | |
| 98 | -        foreach ($this->mapping_fields as $alias => $cfg ) { | 
                                                        |
| 98 | +		foreach ($this->mapping_fields as $alias => $cfg ) { | 
                                                        |
| 99 | 99 | |
| 100 | 100 | $value = false;  | 
                                                        
| 101 | 101 | |
@@ -132,9 +132,9 @@ discard block  | 
                                                    ||
| 132 | 132 | if($value!==false)  | 
                                                        
| 133 | 133 |  				$Entity->{$method_set}($value); | 
                                                        
| 134 | 134 | |
| 135 | - }  | 
                                                        |
| 135 | + }  | 
                                                        |
| 136 | 136 | |
| 137 | - return $Entity;  | 
                                                        |
| 137 | + return $Entity;  | 
                                                        |
| 138 | 138 | }  | 
                                                        
| 139 | 139 | |
| 140 | 140 | |
@@ -148,7 +148,7 @@ discard block  | 
                                                    ||
| 148 | 148 | |
| 149 | 149 | $row = [];  | 
                                                        
| 150 | 150 | |
| 151 | -        foreach ($this->mapping_fields as $alias => $cfg ) { | 
                                                        |
| 151 | +		foreach ($this->mapping_fields as $alias => $cfg ) { | 
                                                        |
| 152 | 152 | |
| 153 | 153 | $field = $cfg['field'];  | 
                                                        
| 154 | 154 | |
@@ -178,9 +178,9 @@ discard block  | 
                                                    ||
| 178 | 178 | |
| 179 | 179 | $row[$field] = $value;  | 
                                                        
| 180 | 180 | |
| 181 | - }  | 
                                                        |
| 181 | + }  | 
                                                        |
| 182 | 182 | |
| 183 | - return $row;  | 
                                                        |
| 183 | + return $row;  | 
                                                        |
| 184 | 184 | }  | 
                                                        
| 185 | 185 | |
| 186 | 186 | |
@@ -191,8 +191,8 @@ discard block  | 
                                                    ||
| 191 | 191 | }  | 
                                                        
| 192 | 192 | |
| 193 | 193 | /**  | 
                                                        
| 194 | - * Построение join-ов  | 
                                                        |
| 195 | - */  | 
                                                        |
| 194 | + * Построение join-ов  | 
                                                        |
| 195 | + */  | 
                                                        |
| 196 | 196 |  	protected function setRelations(ISpecificationCriteria $Specification){ | 
                                                        
| 197 | 197 | |
| 198 | 198 | $joins = [];  | 
                                                        
@@ -12,7 +12,7 @@ discard block  | 
                                                    ||
| 12 | 12 | *  | 
                                                        
| 13 | 13 | * @author d.lanec  | 
                                                        
| 14 | 14 | */  | 
                                                        
| 15 | -abstract class AbstractOptDataMapper extends AbstractDataMapper{ | 
                                                        |
| 15 | +abstract class AbstractOptDataMapper extends AbstractDataMapper { | 
                                                        |
| 16 | 16 | |
| 17 | 17 | protected $soft_delete_key;  | 
                                                        
| 18 | 18 | |
@@ -40,22 +40,22 @@ discard block  | 
                                                    ||
| 40 | 40 | /**  | 
                                                        
| 41 | 41 | * Установка поля для маппинга  | 
                                                        
| 42 | 42 | */  | 
                                                        
| 43 | -	protected function addMappingField($alias,$field = null){ | 
                                                        |
| 43 | +	protected function addMappingField($alias, $field = null) { | 
                                                        |
| 44 | 44 | |
| 45 | -		if(is_string($field)){ | 
                                                        |
| 45 | +		if (is_string($field)) { | 
                                                        |
| 46 | 46 | $field = ['field' => $field];  | 
                                                        
| 47 | 47 | }  | 
                                                        
| 48 | -		elseif(is_array($field) && !isset($field['field'])){ | 
                                                        |
| 49 | - $field['field'] = $alias;  | 
                                                        |
| 48 | +		elseif (is_array($field) && !isset($field['field'])) { | 
                                                        |
| 49 | + $field['field'] = $alias;  | 
                                                        |
| 50 | 50 | }  | 
                                                        
| 51 | 51 | |
| 52 | 52 | $this->mapping_fields[$alias] = $field;  | 
                                                        
| 53 | 53 | |
| 54 | -		if(isset($field['primary']) && $field['primary']===true){ | 
                                                        |
| 54 | +		if (isset($field['primary']) && $field['primary']===true) { | 
                                                        |
| 55 | 55 | $this->key = $field['field'];  | 
                                                        
| 56 | 56 | }  | 
                                                        
| 57 | 57 | |
| 58 | -		if(isset($field['softdelete']) && $field['softdelete']===true){ | 
                                                        |
| 58 | +		if (isset($field['softdelete']) && $field['softdelete']===true) { | 
                                                        |
| 59 | 59 | $this->soft_delete_key = $field['field'];  | 
                                                        
| 60 | 60 | }  | 
                                                        
| 61 | 61 | |
@@ -93,43 +93,43 @@ discard block  | 
                                                    ||
| 93 | 93 | * @return \Core\Infrastructure\EntityInterface  | 
                                                        
| 94 | 94 | * @throws BadMethodCallException  | 
                                                        
| 95 | 95 | */  | 
                                                        
| 96 | -	protected function buildEntity(EntityInterface $Entity, array $row){ | 
                                                        |
| 96 | +	protected function buildEntity(EntityInterface $Entity, array $row) { | 
                                                        |
| 97 | 97 | |
| 98 | -        foreach ($this->mapping_fields as $alias => $cfg ) { | 
                                                        |
| 98 | +        foreach ($this->mapping_fields as $alias => $cfg) { | 
                                                        |
| 99 | 99 | |
| 100 | 100 | $value = false;  | 
                                                        
| 101 | 101 | |
| 102 | 102 | $field = $cfg['field'];  | 
                                                        
| 103 | 103 | |
| 104 | - $method_set = 'set' . ucfirst($alias);  | 
                                                        |
| 104 | + $method_set = 'set'.ucfirst($alias);  | 
                                                        |
| 105 | 105 | |
| 106 | -			if(!method_exists($Entity, $method_set )){ | 
                                                        |
| 106 | +			if (!method_exists($Entity, $method_set)) { | 
                                                        |
| 107 | 107 |  				throw new BadMethodCallException("Метод {$method_set}  не определен"); | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | 109 | |
| 110 | 110 | //событие на формирование поля  | 
                                                        
| 111 | -			if( isset($cfg['build']) && is_object($cfg['build']) ){ | 
                                                        |
| 111 | +			if (isset($cfg['build']) && is_object($cfg['build'])) { | 
                                                        |
| 112 | 112 | $value = call_user_func($cfg['build'], $row);  | 
                                                        
| 113 | 113 | }  | 
                                                        
| 114 | 114 | //на связь  | 
                                                        
| 115 | -			elseif(isset($cfg['relation'])){ | 
                                                        |
| 115 | +			elseif (isset($cfg['relation'])) { | 
                                                        |
| 116 | 116 | |
| 117 | 117 | $mapper = $this->DI->get($cfg['relation']);  | 
                                                        
| 118 | 118 | |
| 119 | -				if($this->use_joins===true){ | 
                                                        |
| 119 | +				if ($this->use_joins===true) { | 
                                                        |
| 120 | 120 | $value = $mapper->createEntity($row);  | 
                                                        
| 121 | 121 | }  | 
                                                        
| 122 | -				else{ | 
                                                        |
| 123 | - $fkey = isset($cfg['on']) ? $cfg['on'] :$mapper->key;  | 
                                                        |
| 122 | +				else { | 
                                                        |
| 123 | + $fkey = isset($cfg['on']) ? $cfg['on'] : $mapper->key;  | 
                                                        |
| 124 | 124 | $value = $mapper->findBySpecification((new Specification)->setWhere($fkey, $row[$field]));  | 
                                                        
| 125 | 125 | }  | 
                                                        
| 126 | 126 | |
| 127 | 127 | }  | 
                                                        
| 128 | -			elseif(is_string($field) && isset($row[strtolower($field)])){ | 
                                                        |
| 128 | +			elseif (is_string($field) && isset($row[strtolower($field)])) { | 
                                                        |
| 129 | 129 | $value = $row[strtolower($field)];  | 
                                                        
| 130 | 130 | }  | 
                                                        
| 131 | 131 | |
| 132 | - if($value!==false)  | 
                                                        |
| 132 | + if ($value!==false)  | 
                                                        |
| 133 | 133 |  				$Entity->{$method_set}($value); | 
                                                        
| 134 | 134 | |
| 135 | 135 | }  | 
                                                        
@@ -144,27 +144,27 @@ discard block  | 
                                                    ||
| 144 | 144 | * @return \Core\Infrastructure\EntityInterface  | 
                                                        
| 145 | 145 | * @throws BadMethodCallException  | 
                                                        
| 146 | 146 | */  | 
                                                        
| 147 | -	protected function unbuildEntity(EntityInterface $Entity){ | 
                                                        |
| 147 | +	protected function unbuildEntity(EntityInterface $Entity) { | 
                                                        |
| 148 | 148 | |
| 149 | 149 | $row = [];  | 
                                                        
| 150 | 150 | |
| 151 | -        foreach ($this->mapping_fields as $alias => $cfg ) { | 
                                                        |
| 151 | +        foreach ($this->mapping_fields as $alias => $cfg) { | 
                                                        |
| 152 | 152 | |
| 153 | 153 | $field = $cfg['field'];  | 
                                                        
| 154 | 154 | |
| 155 | - $method_get = 'get' . ucfirst($alias);  | 
                                                        |
| 155 | + $method_get = 'get'.ucfirst($alias);  | 
                                                        |
| 156 | 156 | |
| 157 | -			if(!method_exists($Entity, $method_get )){ | 
                                                        |
| 157 | +			if (!method_exists($Entity, $method_get)) { | 
                                                        |
| 158 | 158 |  				throw new BadMethodCallException("Метод {$method_get}  не определен"); | 
                                                        
| 159 | 159 | }  | 
                                                        
| 160 | 160 | |
| 161 | 161 | //--------------------------------------------------------------------  | 
                                                        
| 162 | -			if( isset($cfg['unbuild']) && is_object($cfg['unbuild']) ){ | 
                                                        |
| 163 | -				$value = call_user_func($cfg['unbuild'], $Entity->{$method_get}() ); | 
                                                        |
| 162 | +			if (isset($cfg['unbuild']) && is_object($cfg['unbuild'])) { | 
                                                        |
| 163 | +				$value = call_user_func($cfg['unbuild'], $Entity->{$method_get}()); | 
                                                        |
| 164 | 164 | }  | 
                                                        
| 165 | -			elseif(isset($cfg['relation'])){ | 
                                                        |
| 165 | +			elseif (isset($cfg['relation'])) { | 
                                                        |
| 166 | 166 | |
| 167 | - if(isset($cfg['on']))  | 
                                                        |
| 167 | + if (isset($cfg['on']))  | 
                                                        |
| 168 | 168 | $fkey = $this->DI->get($cfg['relation'])->getFieldAlias($cfg['on']);  | 
                                                        
| 169 | 169 | else  | 
                                                        
| 170 | 170 | $fkey = 'id';  | 
                                                        
@@ -172,7 +172,7 @@ discard block  | 
                                                    ||
| 172 | 172 |  				$value = $Entity->{$method_get}()->{'get'.$fkey}(); | 
                                                        
| 173 | 173 | |
| 174 | 174 | }  | 
                                                        
| 175 | -			else{ | 
                                                        |
| 175 | +			else { | 
                                                        |
| 176 | 176 |  				$value = $Entity->{$method_get}(); | 
                                                        
| 177 | 177 | }  | 
                                                        
| 178 | 178 | |
@@ -184,7 +184,7 @@ discard block  | 
                                                    ||
| 184 | 184 | }  | 
                                                        
| 185 | 185 | |
| 186 | 186 | |
| 187 | -	public function getFieldAlias($field){ | 
                                                        |
| 187 | +	public function getFieldAlias($field) { | 
                                                        |
| 188 | 188 | |
| 189 | 189 | return $this->mapping_fields_aliases[$field];  | 
                                                        
| 190 | 190 | |
@@ -193,18 +193,18 @@ discard block  | 
                                                    ||
| 193 | 193 | /**  | 
                                                        
| 194 | 194 | * Построение join-ов  | 
                                                        
| 195 | 195 | */  | 
                                                        
| 196 | -	protected function setRelations(ISpecificationCriteria $Specification){ | 
                                                        |
| 196 | +	protected function setRelations(ISpecificationCriteria $Specification) { | 
                                                        |
| 197 | 197 | |
| 198 | 198 | $joins = [];  | 
                                                        
| 199 | 199 | |
| 200 | -		foreach ($this->mapping_fields as $field => $cfg){ | 
                                                        |
| 201 | -			if(isset($cfg['relation'])){ | 
                                                        |
| 200 | +		foreach ($this->mapping_fields as $field => $cfg) { | 
                                                        |
| 201 | +			if (isset($cfg['relation'])) { | 
                                                        |
| 202 | 202 | |
| 203 | 203 | $this->relations[$field] = $mapper = $this->DI->get($cfg['relation']);  | 
                                                        
| 204 | 204 | |
| 205 | 205 | $table = $mapper->getEntityTable();  | 
                                                        
| 206 | 206 | |
| 207 | - $relation_key = isset($cfg['on'])? $cfg['on'] : $mapper->key;  | 
                                                        |
| 207 | + $relation_key = isset($cfg['on']) ? $cfg['on'] : $mapper->key;  | 
                                                        |
| 208 | 208 | |
| 209 | 209 | $joins[$table] = [  | 
                                                        
| 210 | 210 | 'alias' => $field,  | 
                                                        
@@ -215,7 +215,7 @@ discard block  | 
                                                    ||
| 215 | 215 | }  | 
                                                        
| 216 | 216 | }  | 
                                                        
| 217 | 217 | |
| 218 | -		if($this->use_joins===true){ | 
                                                        |
| 218 | +		if ($this->use_joins===true) { | 
                                                        |
| 219 | 219 | $Specification->setJoins($joins);  | 
                                                        
| 220 | 220 | }  | 
                                                        
| 221 | 221 | }  | 
                                                        
@@ -224,12 +224,12 @@ discard block  | 
                                                    ||
| 224 | 224 | * На успешное сохранение  | 
                                                        
| 225 | 225 | * @param \SimpleORM\EntityInterface $Entity  | 
                                                        
| 226 | 226 | */  | 
                                                        
| 227 | -	protected function onSaveSuccess(EntityInterface $Entity){ | 
                                                        |
| 227 | +	protected function onSaveSuccess(EntityInterface $Entity) { | 
                                                        |
| 228 | 228 | |
| 229 | 229 | |
| 230 | 230 |  		foreach ($this->relations as $alias => $mapper) { | 
                                                        
| 231 | 231 |  			$Entity = $Entity->{'get'.$alias}(); | 
                                                        
| 232 | -			if(!$mapper->save($Entity)){ | 
                                                        |
| 232 | +			if (!$mapper->save($Entity)) { | 
                                                        |
| 233 | 233 |  				throw new \Autoprice\Exceptions\EntityNotSaveException('Unable to save Entity!'); | 
                                                        
| 234 | 234 | }  | 
                                                        
| 235 | 235 | }  | 
                                                        
@@ -244,7 +244,7 @@ discard block  | 
                                                    ||
| 244 | 244 |  	protected function onDeleteSuccess(EntityInterface $Entity) { | 
                                                        
| 245 | 245 |  		foreach ($this->relations as $alias => $mapper) { | 
                                                        
| 246 | 246 |  			$Entity = $Entity->{'get'.$alias}(); | 
                                                        
| 247 | -			if(!$mapper->delete($Entity)){ | 
                                                        |
| 247 | +			if (!$mapper->delete($Entity)) { | 
                                                        |
| 248 | 248 |  				throw new \Autoprice\Exceptions\EntityNotDeleteException('Unable to delete Entity!'); | 
                                                        
| 249 | 249 | }  | 
                                                        
| 250 | 250 | }  | 
                                                        
@@ -44,8 +44,7 @@ discard block  | 
                                                    ||
| 44 | 44 | |
| 45 | 45 |  		if(is_string($field)){ | 
                                                        
| 46 | 46 | $field = ['field' => $field];  | 
                                                        
| 47 | - }  | 
                                                        |
| 48 | -		elseif(is_array($field) && !isset($field['field'])){ | 
                                                        |
| 47 | +		} elseif(is_array($field) && !isset($field['field'])){ | 
                                                        |
| 49 | 48 | $field['field'] = $alias;  | 
                                                        
| 50 | 49 | }  | 
                                                        
| 51 | 50 | |
@@ -118,19 +117,18 @@ discard block  | 
                                                    ||
| 118 | 117 | |
| 119 | 118 |  				if($this->use_joins===true){ | 
                                                        
| 120 | 119 | $value = $mapper->createEntity($row);  | 
                                                        
| 121 | - }  | 
                                                        |
| 122 | -				else{ | 
                                                        |
| 120 | +				} else{ | 
                                                        |
| 123 | 121 | $fkey = isset($cfg['on']) ? $cfg['on'] :$mapper->key;  | 
                                                        
| 124 | 122 | $value = $mapper->findBySpecification((new Specification)->setWhere($fkey, $row[$field]));  | 
                                                        
| 125 | 123 | }  | 
                                                        
| 126 | 124 | |
| 127 | - }  | 
                                                        |
| 128 | -			elseif(is_string($field) && isset($row[strtolower($field)])){ | 
                                                        |
| 125 | +			} elseif(is_string($field) && isset($row[strtolower($field)])){ | 
                                                        |
| 129 | 126 | $value = $row[strtolower($field)];  | 
                                                        
| 130 | 127 | }  | 
                                                        
| 131 | 128 | |
| 132 | - if($value!==false)  | 
                                                        |
| 133 | -				$Entity->{$method_set}($value); | 
                                                        |
| 129 | +			if($value!==false) { | 
                                                        |
| 130 | +							$Entity->{$method_set}($value); | 
                                                        |
| 131 | + }  | 
                                                        |
| 134 | 132 | |
| 135 | 133 | }  | 
                                                        
| 136 | 134 | |
@@ -161,18 +159,17 @@ discard block  | 
                                                    ||
| 161 | 159 | //--------------------------------------------------------------------  | 
                                                        
| 162 | 160 |  			if( isset($cfg['unbuild']) && is_object($cfg['unbuild']) ){ | 
                                                        
| 163 | 161 |  				$value = call_user_func($cfg['unbuild'], $Entity->{$method_get}() ); | 
                                                        
| 164 | - }  | 
                                                        |
| 165 | -			elseif(isset($cfg['relation'])){ | 
                                                        |
| 162 | +			} elseif(isset($cfg['relation'])){ | 
                                                        |
| 166 | 163 | |
| 167 | - if(isset($cfg['on']))  | 
                                                        |
| 168 | - $fkey = $this->DI->get($cfg['relation'])->getFieldAlias($cfg['on']);  | 
                                                        |
| 169 | - else  | 
                                                        |
| 170 | - $fkey = 'id';  | 
                                                        |
| 164 | +				if(isset($cfg['on'])) { | 
                                                        |
| 165 | + $fkey = $this->DI->get($cfg['relation'])->getFieldAlias($cfg['on']);  | 
                                                        |
| 166 | +				} else { | 
                                                        |
| 167 | + $fkey = 'id';  | 
                                                        |
| 168 | + }  | 
                                                        |
| 171 | 169 | |
| 172 | 170 |  				$value = $Entity->{$method_get}()->{'get'.$fkey}(); | 
                                                        
| 173 | 171 | |
| 174 | - }  | 
                                                        |
| 175 | -			else{ | 
                                                        |
| 172 | +			} else{ | 
                                                        |
| 176 | 173 |  				$value = $Entity->{$method_get}(); | 
                                                        
| 177 | 174 | }  | 
                                                        
| 178 | 175 | |
@@ -10,43 +10,43 @@  | 
                                                    ||
| 10 | 10 | */  | 
                                                        
| 11 | 11 | interface ISpecificationCriteria  | 
                                                        
| 12 | 12 |  { | 
                                                        
| 13 | - public function getCriteria();  | 
                                                        |
| 13 | + public function getCriteria();  | 
                                                        |
| 14 | 14 | |
| 15 | 15 | public function getWhere();  | 
                                                        
| 16 | 16 | |
| 17 | - public function getLimit();  | 
                                                        |
| 17 | + public function getLimit();  | 
                                                        |
| 18 | 18 | |
| 19 | - public function getOfset();  | 
                                                        |
| 19 | + public function getOfset();  | 
                                                        |
| 20 | 20 | |
| 21 | - public function getJoins();  | 
                                                        |
| 21 | + public function getJoins();  | 
                                                        |
| 22 | 22 | |
| 23 | - public function getOrder();  | 
                                                        |
| 23 | + public function getOrder();  | 
                                                        |
| 24 | 24 | |
| 25 | - public function getManualJoins();  | 
                                                        |
| 25 | + public function getManualJoins();  | 
                                                        |
| 26 | 26 | |
| 27 | - public function getGroup();  | 
                                                        |
| 27 | + public function getGroup();  | 
                                                        |
| 28 | 28 | |
| 29 | - public function getManualWheres();  | 
                                                        |
| 29 | + public function getManualWheres();  | 
                                                        |
| 30 | 30 | |
| 31 | - public function getWhereType();  | 
                                                        |
| 31 | + public function getWhereType();  | 
                                                        |
| 32 | 32 | |
| 33 | - public function setWhere($field,$value = false);  | 
                                                        |
| 33 | + public function setWhere($field,$value = false);  | 
                                                        |
| 34 | 34 | |
| 35 | - public function setLimit($limit);  | 
                                                        |
| 35 | + public function setLimit($limit);  | 
                                                        |
| 36 | 36 | |
| 37 | - public function setOfset($ofset);  | 
                                                        |
| 37 | + public function setOfset($ofset);  | 
                                                        |
| 38 | 38 | |
| 39 | - public function setJoins($joins);  | 
                                                        |
| 39 | + public function setJoins($joins);  | 
                                                        |
| 40 | 40 | |
| 41 | - public function setOrder($order);  | 
                                                        |
| 41 | + public function setOrder($order);  | 
                                                        |
| 42 | 42 | |
| 43 | - public function setManualJoins($manualJoins);  | 
                                                        |
| 43 | + public function setManualJoins($manualJoins);  | 
                                                        |
| 44 | 44 | |
| 45 | - public function setGroup($group);  | 
                                                        |
| 45 | + public function setGroup($group);  | 
                                                        |
| 46 | 46 | |
| 47 | - public function setManualWheres($manualWheres);  | 
                                                        |
| 47 | + public function setManualWheres($manualWheres);  | 
                                                        |
| 48 | 48 | |
| 49 | - public function setWhereType($whereType);  | 
                                                        |
| 49 | + public function setWhereType($whereType);  | 
                                                        |
| 50 | 50 | |
| 51 | 51 | }  | 
                                                        
| 52 | 52 | |
@@ -30,7 +30,7 @@  | 
                                                    ||
| 30 | 30 | |
| 31 | 31 | public function getWhereType();  | 
                                                        
| 32 | 32 | |
| 33 | - public function setWhere($field,$value = false);  | 
                                                        |
| 33 | + public function setWhere($field, $value = false);  | 
                                                        |
| 34 | 34 | |
| 35 | 35 | public function setLimit($limit);  | 
                                                        
| 36 | 36 | |
@@ -10,29 +10,29 @@  | 
                                                    ||
| 10 | 10 | abstract class AbstractEntity implements EntityInterface  | 
                                                        
| 11 | 11 |  { | 
                                                        
| 12 | 12 | |
| 13 | - protected $id;  | 
                                                        |
| 13 | + protected $id;  | 
                                                        |
| 14 | 14 | |
| 15 | 15 | protected $deleted;  | 
                                                        
| 16 | 16 | |
| 17 | 17 | public function getId()  | 
                                                        
| 18 | -    { | 
                                                        |
| 19 | - return $this->id;  | 
                                                        |
| 20 | - }  | 
                                                        |
| 18 | +	{ | 
                                                        |
| 19 | + return $this->id;  | 
                                                        |
| 20 | + }  | 
                                                        |
| 21 | 21 | |
| 22 | - public function setId($id)  | 
                                                        |
| 23 | -    { | 
                                                        |
| 24 | -        if ($this->id !== null) { | 
                                                        |
| 25 | - throw new BadMethodCallException(  | 
                                                        |
| 26 | - "Идентификатор у сущности уже установлен");  | 
                                                        |
| 27 | - }  | 
                                                        |
| 22 | + public function setId($id)  | 
                                                        |
| 23 | +	{ | 
                                                        |
| 24 | +		if ($this->id !== null) { | 
                                                        |
| 25 | + throw new BadMethodCallException(  | 
                                                        |
| 26 | + "Идентификатор у сущности уже установлен");  | 
                                                        |
| 27 | + }  | 
                                                        |
| 28 | 28 | |
| 29 | -        if ($id < 1) { | 
                                                        |
| 30 | -            throw new InvalidArgumentException("Неверный индентификатор"); | 
                                                        |
| 31 | - }  | 
                                                        |
| 29 | +		if ($id < 1) { | 
                                                        |
| 30 | +			throw new InvalidArgumentException("Неверный индентификатор"); | 
                                                        |
| 31 | + }  | 
                                                        |
| 32 | 32 | |
| 33 | - $this->id = $id;  | 
                                                        |
| 34 | - return $this;  | 
                                                        |
| 35 | - }  | 
                                                        |
| 33 | + $this->id = $id;  | 
                                                        |
| 34 | + return $this;  | 
                                                        |
| 35 | + }  | 
                                                        |
| 36 | 36 | |
| 37 | 37 |  	public function setDeleted($deleted){ | 
                                                        
| 38 | 38 | $this->deleted = $deleted;  | 
                                                        
@@ -21,7 +21,7 @@ discard block  | 
                                                    ||
| 21 | 21 | |
| 22 | 22 | public function setId($id)  | 
                                                        
| 23 | 23 |      { | 
                                                        
| 24 | -        if ($this->id !== null) { | 
                                                        |
| 24 | +        if ($this->id!==null) { | 
                                                        |
| 25 | 25 | throw new BadMethodCallException(  | 
                                                        
| 26 | 26 | "Идентификатор у сущности уже установлен");  | 
                                                        
| 27 | 27 | }  | 
                                                        
@@ -34,7 +34,7 @@ discard block  | 
                                                    ||
| 34 | 34 | return $this;  | 
                                                        
| 35 | 35 | }  | 
                                                        
| 36 | 36 | |
| 37 | -	public function setDeleted($deleted){ | 
                                                        |
| 37 | +	public function setDeleted($deleted) { | 
                                                        |
| 38 | 38 | $this->deleted = $deleted;  | 
                                                        
| 39 | 39 | }  | 
                                                        
| 40 | 40 | |
@@ -10,134 +10,134 @@  | 
                                                    ||
| 10 | 10 | class Specification implements ISpecificationCriteria  | 
                                                        
| 11 | 11 |  { | 
                                                        
| 12 | 12 | |
| 13 | - protected $where = [];  | 
                                                        |
| 13 | + protected $where = [];  | 
                                                        |
| 14 | 14 | |
| 15 | - protected $limit = 0;  | 
                                                        |
| 15 | + protected $limit = 0;  | 
                                                        |
| 16 | 16 | |
| 17 | - protected $ofset = 0;  | 
                                                        |
| 17 | + protected $ofset = 0;  | 
                                                        |
| 18 | 18 | |
| 19 | - protected $joins = [];  | 
                                                        |
| 19 | + protected $joins = [];  | 
                                                        |
| 20 | 20 | |
| 21 | - protected $order = [];  | 
                                                        |
| 21 | + protected $order = [];  | 
                                                        |
| 22 | 22 | |
| 23 | - protected $manualJoins = [];  | 
                                                        |
| 23 | + protected $manualJoins = [];  | 
                                                        |
| 24 | 24 | |
| 25 | - protected $group = null;  | 
                                                        |
| 25 | + protected $group = null;  | 
                                                        |
| 26 | 26 | |
| 27 | - protected $manualWheres = [];  | 
                                                        |
| 27 | + protected $manualWheres = [];  | 
                                                        |
| 28 | 28 | |
| 29 | - protected $whereType = 'AND';  | 
                                                        |
| 29 | + protected $whereType = 'AND';  | 
                                                        |
| 30 | 30 | |
| 31 | - function getWhere()  | 
                                                        |
| 32 | -    { | 
                                                        |
| 33 | - return $this->where;  | 
                                                        |
| 34 | - }  | 
                                                        |
| 35 | -  | 
                                                        |
| 36 | - function getLimit()  | 
                                                        |
| 37 | -    { | 
                                                        |
| 38 | - return $this->limit;  | 
                                                        |
| 39 | - }  | 
                                                        |
| 40 | -  | 
                                                        |
| 41 | - function getOfset()  | 
                                                        |
| 42 | -    { | 
                                                        |
| 43 | - return $this->ofset;  | 
                                                        |
| 44 | - }  | 
                                                        |
| 45 | -  | 
                                                        |
| 46 | - function getJoins()  | 
                                                        |
| 47 | -    { | 
                                                        |
| 48 | - return $this->joins;  | 
                                                        |
| 49 | - }  | 
                                                        |
| 50 | -  | 
                                                        |
| 51 | - function getOrder()  | 
                                                        |
| 52 | -    { | 
                                                        |
| 53 | - return $this->order;  | 
                                                        |
| 54 | - }  | 
                                                        |
| 55 | -  | 
                                                        |
| 56 | - function getManualJoins()  | 
                                                        |
| 57 | -    { | 
                                                        |
| 58 | - return $this->manualJoins;  | 
                                                        |
| 59 | - }  | 
                                                        |
| 60 | -  | 
                                                        |
| 61 | - function getGroup()  | 
                                                        |
| 62 | -    { | 
                                                        |
| 63 | - return $this->group;  | 
                                                        |
| 64 | - }  | 
                                                        |
| 65 | -  | 
                                                        |
| 66 | - function getManualWheres()  | 
                                                        |
| 67 | -    { | 
                                                        |
| 68 | - return $this->manualWheres;  | 
                                                        |
| 69 | - }  | 
                                                        |
| 70 | -  | 
                                                        |
| 71 | - function getWhereType()  | 
                                                        |
| 72 | -    { | 
                                                        |
| 73 | - return $this->whereType;  | 
                                                        |
| 74 | - }  | 
                                                        |
| 75 | -  | 
                                                        |
| 76 | - function setWhere($field,$value = false)  | 
                                                        |
| 77 | -    { | 
                                                        |
| 78 | -        if($value!==false){ | 
                                                        |
| 79 | - $this->where[$field] = $value;  | 
                                                        |
| 80 | - }  | 
                                                        |
| 81 | -        else{ | 
                                                        |
| 82 | - $this->where = $where;  | 
                                                        |
| 83 | - }  | 
                                                        |
| 31 | + function getWhere()  | 
                                                        |
| 32 | +	{ | 
                                                        |
| 33 | + return $this->where;  | 
                                                        |
| 34 | + }  | 
                                                        |
| 35 | +  | 
                                                        |
| 36 | + function getLimit()  | 
                                                        |
| 37 | +	{ | 
                                                        |
| 38 | + return $this->limit;  | 
                                                        |
| 39 | + }  | 
                                                        |
| 40 | +  | 
                                                        |
| 41 | + function getOfset()  | 
                                                        |
| 42 | +	{ | 
                                                        |
| 43 | + return $this->ofset;  | 
                                                        |
| 44 | + }  | 
                                                        |
| 45 | +  | 
                                                        |
| 46 | + function getJoins()  | 
                                                        |
| 47 | +	{ | 
                                                        |
| 48 | + return $this->joins;  | 
                                                        |
| 49 | + }  | 
                                                        |
| 50 | +  | 
                                                        |
| 51 | + function getOrder()  | 
                                                        |
| 52 | +	{ | 
                                                        |
| 53 | + return $this->order;  | 
                                                        |
| 54 | + }  | 
                                                        |
| 55 | +  | 
                                                        |
| 56 | + function getManualJoins()  | 
                                                        |
| 57 | +	{ | 
                                                        |
| 58 | + return $this->manualJoins;  | 
                                                        |
| 59 | + }  | 
                                                        |
| 60 | +  | 
                                                        |
| 61 | + function getGroup()  | 
                                                        |
| 62 | +	{ | 
                                                        |
| 63 | + return $this->group;  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | +  | 
                                                        |
| 66 | + function getManualWheres()  | 
                                                        |
| 67 | +	{ | 
                                                        |
| 68 | + return $this->manualWheres;  | 
                                                        |
| 69 | + }  | 
                                                        |
| 70 | +  | 
                                                        |
| 71 | + function getWhereType()  | 
                                                        |
| 72 | +	{ | 
                                                        |
| 73 | + return $this->whereType;  | 
                                                        |
| 74 | + }  | 
                                                        |
| 75 | +  | 
                                                        |
| 76 | + function setWhere($field,$value = false)  | 
                                                        |
| 77 | +	{ | 
                                                        |
| 78 | +		if($value!==false){ | 
                                                        |
| 79 | + $this->where[$field] = $value;  | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | +		else{ | 
                                                        |
| 82 | + $this->where = $where;  | 
                                                        |
| 83 | + }  | 
                                                        |
| 84 | 84 | |
| 85 | - return $this;  | 
                                                        |
| 86 | - }  | 
                                                        |
| 87 | -  | 
                                                        |
| 88 | - function setLimit($limit)  | 
                                                        |
| 89 | -    { | 
                                                        |
| 90 | - $this->limit = $limit;  | 
                                                        |
| 91 | - return $this;  | 
                                                        |
| 92 | - }  | 
                                                        |
| 93 | -  | 
                                                        |
| 94 | - function setOfset($ofset)  | 
                                                        |
| 95 | -    { | 
                                                        |
| 96 | - $this->ofset = $ofset;  | 
                                                        |
| 97 | - return $this;  | 
                                                        |
| 98 | - }  | 
                                                        |
| 99 | -  | 
                                                        |
| 100 | - function setJoins($joins)  | 
                                                        |
| 101 | -    { | 
                                                        |
| 102 | - $this->joins = $joins;  | 
                                                        |
| 103 | - return $this;  | 
                                                        |
| 104 | - }  | 
                                                        |
| 105 | -  | 
                                                        |
| 106 | - function setOrder($order)  | 
                                                        |
| 107 | -    { | 
                                                        |
| 108 | - $this->order = $order;  | 
                                                        |
| 109 | - return $this;  | 
                                                        |
| 110 | - }  | 
                                                        |
| 111 | -  | 
                                                        |
| 112 | - function setManualJoins($manualJoins)  | 
                                                        |
| 113 | -    { | 
                                                        |
| 114 | - $this->manualJoins = $manualJoins;  | 
                                                        |
| 115 | - return $this;  | 
                                                        |
| 116 | - }  | 
                                                        |
| 117 | -  | 
                                                        |
| 118 | - function setGroup($group)  | 
                                                        |
| 119 | -    { | 
                                                        |
| 120 | - $this->group = $group;  | 
                                                        |
| 121 | - return $this;  | 
                                                        |
| 122 | - }  | 
                                                        |
| 123 | -  | 
                                                        |
| 124 | - function setManualWheres($manualWheres)  | 
                                                        |
| 125 | -    { | 
                                                        |
| 126 | - $this->manualWheres = $manualWheres;  | 
                                                        |
| 127 | - return $this;  | 
                                                        |
| 128 | - }  | 
                                                        |
| 129 | -  | 
                                                        |
| 130 | - function setWhereType($whereType)  | 
                                                        |
| 131 | -    { | 
                                                        |
| 132 | - $this->whereType = $whereType;  | 
                                                        |
| 133 | - return $this;  | 
                                                        |
| 134 | - }  | 
                                                        |
| 135 | -  | 
                                                        |
| 136 | - /**  | 
                                                        |
| 137 | - * Создание критериев  | 
                                                        |
| 138 | - */  | 
                                                        |
| 139 | - public function getCriteria()  | 
                                                        |
| 140 | -    { | 
                                                        |
| 85 | + return $this;  | 
                                                        |
| 86 | + }  | 
                                                        |
| 87 | +  | 
                                                        |
| 88 | + function setLimit($limit)  | 
                                                        |
| 89 | +	{ | 
                                                        |
| 90 | + $this->limit = $limit;  | 
                                                        |
| 91 | + return $this;  | 
                                                        |
| 92 | + }  | 
                                                        |
| 93 | +  | 
                                                        |
| 94 | + function setOfset($ofset)  | 
                                                        |
| 95 | +	{ | 
                                                        |
| 96 | + $this->ofset = $ofset;  | 
                                                        |
| 97 | + return $this;  | 
                                                        |
| 98 | + }  | 
                                                        |
| 99 | +  | 
                                                        |
| 100 | + function setJoins($joins)  | 
                                                        |
| 101 | +	{ | 
                                                        |
| 102 | + $this->joins = $joins;  | 
                                                        |
| 103 | + return $this;  | 
                                                        |
| 104 | + }  | 
                                                        |
| 105 | +  | 
                                                        |
| 106 | + function setOrder($order)  | 
                                                        |
| 107 | +	{ | 
                                                        |
| 108 | + $this->order = $order;  | 
                                                        |
| 109 | + return $this;  | 
                                                        |
| 110 | + }  | 
                                                        |
| 111 | +  | 
                                                        |
| 112 | + function setManualJoins($manualJoins)  | 
                                                        |
| 113 | +	{ | 
                                                        |
| 114 | + $this->manualJoins = $manualJoins;  | 
                                                        |
| 115 | + return $this;  | 
                                                        |
| 116 | + }  | 
                                                        |
| 117 | +  | 
                                                        |
| 118 | + function setGroup($group)  | 
                                                        |
| 119 | +	{ | 
                                                        |
| 120 | + $this->group = $group;  | 
                                                        |
| 121 | + return $this;  | 
                                                        |
| 122 | + }  | 
                                                        |
| 123 | +  | 
                                                        |
| 124 | + function setManualWheres($manualWheres)  | 
                                                        |
| 125 | +	{ | 
                                                        |
| 126 | + $this->manualWheres = $manualWheres;  | 
                                                        |
| 127 | + return $this;  | 
                                                        |
| 128 | + }  | 
                                                        |
| 129 | +  | 
                                                        |
| 130 | + function setWhereType($whereType)  | 
                                                        |
| 131 | +	{ | 
                                                        |
| 132 | + $this->whereType = $whereType;  | 
                                                        |
| 133 | + return $this;  | 
                                                        |
| 134 | + }  | 
                                                        |
| 135 | +  | 
                                                        |
| 136 | + /**  | 
                                                        |
| 137 | + * Создание критериев  | 
                                                        |
| 138 | + */  | 
                                                        |
| 139 | + public function getCriteria()  | 
                                                        |
| 140 | +	{ | 
                                                        |
| 141 | 141 | |
| 142 | - }  | 
                                                        |
| 142 | + }  | 
                                                        |
| 143 | 143 | }  | 
                                                        
@@ -73,12 +73,12 @@  | 
                                                    ||
| 73 | 73 | return $this->whereType;  | 
                                                        
| 74 | 74 | }  | 
                                                        
| 75 | 75 | |
| 76 | - function setWhere($field,$value = false)  | 
                                                        |
| 76 | + function setWhere($field, $value = false)  | 
                                                        |
| 77 | 77 |      { | 
                                                        
| 78 | -        if($value!==false){ | 
                                                        |
| 78 | +        if ($value!==false) { | 
                                                        |
| 79 | 79 | $this->where[$field] = $value;  | 
                                                        
| 80 | 80 | }  | 
                                                        
| 81 | -        else{ | 
                                                        |
| 81 | +        else { | 
                                                        |
| 82 | 82 | $this->where = $where;  | 
                                                        
| 83 | 83 | }  | 
                                                        
| 84 | 84 | |
@@ -77,8 +77,7 @@  | 
                                                    ||
| 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 | |
@@ -10,15 +10,15 @@  | 
                                                    ||
| 10 | 10 | interface RepositoryInterface  | 
                                                        
| 11 | 11 |  { | 
                                                        
| 12 | 12 | |
| 13 | - public function findById($id);  | 
                                                        |
| 13 | + public function findById($id);  | 
                                                        |
| 14 | 14 | |
| 15 | - public function findBySpecification(ISpecificationCriteria $specification);  | 
                                                        |
| 15 | + public function findBySpecification(ISpecificationCriteria $specification);  | 
                                                        |
| 16 | 16 | |
| 17 | - public function findAll();  | 
                                                        |
| 17 | + public function findAll();  | 
                                                        |
| 18 | 18 | |
| 19 | - public function findAllBySpecification(ISpecificationCriteria $specification);  | 
                                                        |
| 19 | + public function findAllBySpecification(ISpecificationCriteria $specification);  | 
                                                        |
| 20 | 20 | |
| 21 | - public function save(EntityInterface $Entity);  | 
                                                        |
| 21 | + public function save(EntityInterface $Entity);  | 
                                                        |
| 22 | 22 | |
| 23 | - public function delete(EntityInterface $Entity);  | 
                                                        |
| 23 | + public function delete(EntityInterface $Entity);  | 
                                                        |
| 24 | 24 | }  | 
                                                        
@@ -14,13 +14,13 @@  | 
                                                    ||
| 14 | 14 | */  | 
                                                        
| 15 | 15 |  interface QueryBuilderInterface { | 
                                                        
| 16 | 16 | |
| 17 | - public function getResultQuery($table,\SimpleORM\ISpecificationCriteria $Criteria);  | 
                                                        |
| 17 | + public function getResultQuery($table, \SimpleORM\ISpecificationCriteria $Criteria);  | 
                                                        |
| 18 | 18 | |
| 19 | - public function update($table,array $data,$where = []);  | 
                                                        |
| 19 | + public function update($table, array $data, $where = []);  | 
                                                        |
| 20 | 20 | |
| 21 | - public function insert($table,array $data);  | 
                                                        |
| 21 | + public function insert($table, array $data);  | 
                                                        |
| 22 | 22 | |
| 23 | 23 | public function insert_id();  | 
                                                        
| 24 | 24 | |
| 25 | - public function delete($table,$where = []);  | 
                                                        |
| 25 | + public function delete($table, $where = []);  | 
                                                        |
| 26 | 26 | }  | 
                                                        
@@ -8,12 +8,12 @@  | 
                                                    ||
| 8 | 8 | */  | 
                                                        
| 9 | 9 | interface EntityInterface  | 
                                                        
| 10 | 10 |  { | 
                                                        
| 11 | - //put your code here  | 
                                                        |
| 12 | - public function getId();  | 
                                                        |
| 11 | + //put your code here  | 
                                                        |
| 12 | + public function getId();  | 
                                                        |
| 13 | 13 | |
| 14 | - public function setId($id);  | 
                                                        |
| 14 | + public function setId($id);  | 
                                                        |
| 15 | 15 | |
| 16 | - public function getDeleted();  | 
                                                        |
| 16 | + public function getDeleted();  | 
                                                        |
| 17 | 17 | |
| 18 | - public function setDeleted($delete);  | 
                                                        |
| 18 | + public function setDeleted($delete);  | 
                                                        |
| 19 | 19 | }  |