@@ -19,8 +19,9 @@ discard block |
||
| 19 | 19 | public function genetateFromModel(Contract $data) |
| 20 | 20 | { |
| 21 | 21 | $file = $data->getContractFile(); |
| 22 | - if (!$file) |
|
| 23 | - $file = new File(); |
|
| 22 | + if (!$file) { |
|
| 23 | + $file = new File(); |
|
| 24 | + } |
|
| 24 | 25 | |
| 25 | 26 | $file->setFileType('text'); |
| 26 | 27 | $file->setExtension('html'); |
@@ -41,8 +42,9 @@ discard block |
||
| 41 | 42 | { |
| 42 | 43 | $content = $contract->getContractFile()->getContent(); |
| 43 | 44 | |
| 44 | - if ($contract->getContractFile()->getExtension() == 'pdf') |
|
| 45 | - return $content; |
|
| 45 | + if ($contract->getContractFile()->getExtension() == 'pdf') { |
|
| 46 | + return $content; |
|
| 47 | + } |
|
| 46 | 48 | |
| 47 | 49 | if (empty($content)) { |
| 48 | 50 | throw new \Exception( |
@@ -56,7 +58,8 @@ discard block |
||
| 56 | 58 | |
| 57 | 59 | public function afterPersist(Contract $contract) |
| 58 | 60 | { |
| 59 | - if ($contract->getStatus()->getRealStatus() == 'open') |
|
| 60 | - return $this->genetateFromModel($contract); |
|
| 61 | + if ($contract->getStatus()->getRealStatus() == 'open') { |
|
| 62 | + return $this->genetateFromModel($contract); |
|
| 63 | + } |
|
| 61 | 64 | } |
| 62 | 65 | } |