Пример #1
0
 public function testBuildLogEntryWithUnsupportedSecurityToken()
 {
     $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');
     $token->expects($this->once())->method('getUser')->willReturn('test');
     $this->tokenStorage->expects($this->any())->method('getToken')->willReturn($token);
     $this->configManager->expects($this->never())->method('getUpdateConfig');
     $this->auditManager->buildLogEntry($this->configManager);
 }
Пример #2
0
 public function flush()
 {
     $models = [];
     $this->prepareFlush($models);
     $em = $this->getEntityManager();
     $logEntry = $this->auditManager->buildLogEntry($this);
     if (null !== $logEntry) {
         $em->persist($logEntry);
     }
     foreach ($models as $model) {
         $em->persist($model);
     }
     // @todo: need investigation if we can call this flush only if !empty($models)
     $em->flush();
     $this->eventDispatcher->dispatch(Events::POST_FLUSH_CONFIG, new FlushConfigEvent($models, $this));
     if (!empty($models)) {
         $this->cache->deleteAllConfigurable();
     }
     $this->persistConfigs = [];
     $this->configChangeSets = [];
 }