| Conditions | 3 |
| Paths | 1 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function createLogEntity(ActiveRecord $entity, $action, $safeOldData = true, $saveNewData = true) |
||
| 30 | { |
||
| 31 | $log = new Log(); |
||
| 32 | $log->setAttributes([ |
||
| 33 | 'action' => $action, |
||
| 34 | 'item_type' => $this->getEntityType($entity), |
||
| 35 | 'item_id' => $entity->getPrimaryKey(), |
||
| 36 | 'old_data' => $safeOldData ? Json::encode($entity->toArray()) : '', |
||
| 37 | 'new_data' => $saveNewData ? Json::encode($entity->getOldAttributes()) : '', |
||
| 38 | ]); |
||
| 39 | return $log; |
||
| 40 | } |
||
| 52 |