Total Complexity | 2 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | trait XApiActivityTrait |
||
11 | { |
||
12 | /** |
||
13 | * @throws OptimisticLockException |
||
14 | * @throws ORMException |
||
15 | */ |
||
16 | protected function saveSharedStatement(Statement $statement): SharedStatement |
||
17 | { |
||
18 | $statementSerialized = $this->serializeStatement($statement); |
||
19 | |||
20 | $sharedStmt = new SharedStatement( |
||
21 | json_decode($statementSerialized, true) |
||
22 | ); |
||
23 | |||
24 | $em = Database::getManager(); |
||
25 | $em->persist($sharedStmt); |
||
26 | $em->flush(); |
||
27 | |||
28 | return $sharedStmt; |
||
29 | } |
||
30 | |||
31 | private function serializeStatement(Statement $statement) |
||
37 | } |
||
38 | } |