Code Duplication    Length = 13-13 lines in 2 locations

Bundle/BlogBundle/Listener/ArticleSubscriber.php 1 location

@@ 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.

Bundle/PageBundle/EventSubscriber/PageSubscriber.php 1 location

@@ 82-94 (lines=13) @@
79
    /**
80
     * @param OnFlushEventArgs $eventArgs
81
     */
82
    public function onFlush(OnFlushEventArgs $eventArgs)
83
    {
84
        /** @var EntityManager $entityManager */
85
        $entityManager = $eventArgs->getEntityManager();
86
        /** @var UnitOfWork $uow */
87
        $uow = $entityManager->getUnitOfWork();
88
89
        foreach ($uow->getScheduledEntityInsertions() as $entity) {
90
            if ($entity instanceof View) {
91
                $entity->setAuthor($this->userCallableHelper->getCurrentUser());
92
            }
93
        }
94
    }
95
96
    /**
97
     * Insert enabled widgets in base widget DiscriminatorMap.