@@ 26-39 (lines=14) @@ | ||
23 | /** |
|
24 | * {@inheritdoc} |
|
25 | */ |
|
26 | public function persist($entity, $flush = true) |
|
27 | { |
|
28 | return $this->transactionManager->transactional( |
|
29 | function () use ($entity, $flush) { |
|
30 | $this->getEntityManager()->persist($entity); |
|
31 | ||
32 | if ($flush) { |
|
33 | $this->getEntityManager()->flush($entity); |
|
34 | } |
|
35 | ||
36 | return $entity; |
|
37 | } |
|
38 | ); |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * {@inheritdoc} |
|
@@ 44-57 (lines=14) @@ | ||
41 | /** |
|
42 | * {@inheritdoc} |
|
43 | */ |
|
44 | public function merge($entity, $flush = false) |
|
45 | { |
|
46 | return $this->transactionManager->transactional( |
|
47 | function () use ($entity, $flush) { |
|
48 | $entity = $this->getEntityManager()->merge($entity); |
|
49 | ||
50 | if ($flush) { |
|
51 | $this->getEntityManager()->flush($entity); |
|
52 | } |
|
53 | ||
54 | return $entity; |
|
55 | } |
|
56 | ); |
|
57 | } |
|
58 | ||
59 | /** |
|
60 | * {@inheritdoc} |
|
@@ 78-89 (lines=12) @@ | ||
75 | /** |
|
76 | * {@inheritdoc} |
|
77 | */ |
|
78 | public function remove($entity, $flush = false) |
|
79 | { |
|
80 | return $this->transactionManager->transactional( |
|
81 | function () use ($entity, $flush) { |
|
82 | $this->getEntityManager()->remove($entity); |
|
83 | ||
84 | if ($flush) { |
|
85 | $this->getEntityManager()->flush($entity); |
|
86 | } |
|
87 | } |
|
88 | ); |
|
89 | } |
|
90 | ||
91 | /** |
|
92 | * {@inheritdoc} |
|
@@ 94-103 (lines=10) @@ | ||
91 | /** |
|
92 | * {@inheritdoc} |
|
93 | */ |
|
94 | public function removeById($id, $flush = false) |
|
95 | { |
|
96 | return $this->transactionManager->transactional( |
|
97 | function () use ($id, $flush) { |
|
98 | /** @var EntityInterface $entity */ |
|
99 | $entity = $this->find($id); |
|
100 | $this->remove($entity, $flush); |
|
101 | } |
|
102 | ); |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * {@inheritdoc} |