@@ 51-63 (lines=13) @@ | ||
48 | /** |
|
49 | * @param OnFlushEventArgs $eventArgs |
|
50 | */ |
|
51 | public function onFlush(OnFlushEventArgs $eventArgs) |
|
52 | { |
|
53 | /** @var EntityManager $entityManager */ |
|
54 | $entityManager = $eventArgs->getEntityManager(); |
|
55 | /** @var UnitOfWork $uow */ |
|
56 | $uow = $entityManager->getUnitOfWork(); |
|
57 | ||
58 | foreach ($uow->getScheduledEntityInsertions() as $entity) { |
|
59 | if ($entity instanceof Article) { |
|
60 | $entity->setAuthor($this->userCallableHelper->getCurrentUser()); |
|
61 | } |
|
62 | } |
|
63 | } |
|
64 | ||
65 | /** |
|
66 | * Insert enabled widgets in base widget DiscriminatorMap. |
@@ 89-101 (lines=13) @@ | ||
86 | /** |
|
87 | * @param OnFlushEventArgs $eventArgs |
|
88 | */ |
|
89 | public function onFlush(OnFlushEventArgs $eventArgs) |
|
90 | { |
|
91 | /** @var EntityManager $entityManager */ |
|
92 | $entityManager = $eventArgs->getEntityManager(); |
|
93 | /** @var UnitOfWork $uow */ |
|
94 | $uow = $entityManager->getUnitOfWork(); |
|
95 | ||
96 | foreach ($uow->getScheduledEntityInsertions() as $entity) { |
|
97 | if ($entity instanceof View) { |
|
98 | $entity->setAuthor($this->userCallableHelper->getCurrentUser()); |
|
99 | } |
|
100 | } |
|
101 | } |
|
102 | ||
103 | /** |
|
104 | * Insert enabled widgets in base widget DiscriminatorMap. |