@@ -68,8 +68,9 @@ discard block |
||
68 | 68 | $this->lazy = $lazy; |
69 | 69 | |
70 | 70 | // Se não for lazy load, carrega o objeto |
71 | - if(!$this->lazy) |
|
72 | - $this->populate($this->where); |
|
71 | + if(!$this->lazy) { |
|
72 | + $this->populate($this->where); |
|
73 | + } |
|
73 | 74 | } |
74 | 75 | |
75 | 76 | /** |
@@ -84,8 +85,9 @@ discard block |
||
84 | 85 | public function __call($name, $arg) |
85 | 86 | { |
86 | 87 | // Carrega o objeto se por lazy load |
87 | - if($this->lazy) |
|
88 | - $this->populate($this->where); |
|
88 | + if($this->lazy) { |
|
89 | + $this->populate($this->where); |
|
90 | + } |
|
89 | 91 | } |
90 | 92 | |
91 | 93 | /** |
@@ -126,8 +128,9 @@ discard block |
||
126 | 128 | */ |
127 | 129 | private function populateFromId($id) |
128 | 130 | { |
129 | - if(empty($this->primaryKey)) |
|
130 | - throw new NoPrimaryKeyException(); |
|
131 | + if(empty($this->primaryKey)) { |
|
132 | + throw new NoPrimaryKeyException(); |
|
133 | + } |
|
131 | 134 | |
132 | 135 | $this->populateFromWhere([$this->primaryKey => $id]); |
133 | 136 | } |
@@ -145,8 +148,9 @@ discard block |
||
145 | 148 | { |
146 | 149 | $resultSet = $this->tableGateway->select($where); |
147 | 150 | |
148 | - if($resultSet->count() === 0) |
|
149 | - throw new NoDataFoundException(); |
|
151 | + if($resultSet->count() === 0) { |
|
152 | + throw new NoDataFoundException(); |
|
153 | + } |
|
150 | 154 | |
151 | 155 | $array = $resultSet->toArray()[0]; |
152 | 156 | Populator::populate($this, $array); |
@@ -165,8 +169,7 @@ discard block |
||
165 | 169 | if(empty($this->getId())) |
166 | 170 | { |
167 | 171 | return $this->insert(); |
168 | - } |
|
169 | - else |
|
172 | + } else |
|
170 | 173 | { |
171 | 174 | return $this->update(); |
172 | 175 | } |
@@ -187,8 +190,9 @@ discard block |
||
187 | 190 | $table = new TableGateway(self::getInstance()); |
188 | 191 | $resultSet = $table->select($where); |
189 | 192 | |
190 | - if($resultSet->count() === 0) |
|
191 | - throw new NoDataFoundException(); |
|
193 | + if($resultSet->count() === 0) { |
|
194 | + throw new NoDataFoundException(); |
|
195 | + } |
|
192 | 196 | |
193 | 197 | $list = new ArrayList(); |
194 | 198 | |
@@ -244,8 +248,7 @@ discard block |
||
244 | 248 | if(!empty($this->primaryKey)) |
245 | 249 | { |
246 | 250 | return $this->tableGateway->delete([$this->primaryKey => $this->getId()]); |
247 | - } |
|
248 | - else |
|
251 | + } else |
|
249 | 252 | { |
250 | 253 | return $this->tableGateway->delete(Extractor::extract($this)); |
251 | 254 | } |