//Map user config if (isset($extra['config'])) { foreach ($extra['config'] as $k => $v) { /** * @var $userConfig \Core\Model\Config\UserConfigModel */ if ($k && $k !== 'id' && $k !== 'text' && $k !== 'null') { $userConfig = new \Core\Model\Config\UserConfigModel(); $userConfig->userId = $userId; $userConfig->context = $orgId; $userConfig->namespace = "portal"; $userConfig->tags = array(); $userConfig->config = mapToConfig($k, $v, $userConfig); echo 'The user "' . $user->userName . '" has new config info ' . $userConfig->id . ' -> ' . $userConfig->config[$userConfig->id] . PHP_EOL; echo "---userId:" . $userConfig->id . "\n"; \Core\Model\Mapper\UserConfigMapper::getInstance()->update($userConfig); } } } //Map user transactions if (isset($extra['transactions'])) { foreach ($extra['transactions'] as $transaction) { $watcher = new \Core\Model\WatcherModel(); $watcher->scope = 'user'; $watcher->scopeId = $userId; $watcher->owner = $userId; $watcher->namespace = 'portal'; $watcher->entityType = 'transaction'; $watcher->transport = 'popbox'; $watcher->priority = \Core\Model\WatcherModel::PRIORITY_LOW; $watcher->tags = array('context_' . $orgId);
/** * Initialize service */ protected function _init() { $this->_mapper = UserConfigMapper::getInstance(); }
public function tearDown() { if ($this->_itemId) { UserConfigMapper::getInstance()->delete($this->_itemId); } }