本文整理汇总了PHP中Oro\Bundle\ConfigBundle\Config\ConfigManager::set方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::set方法的具体用法?PHP ConfigManager::set怎么用?PHP ConfigManager::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\ConfigBundle\Config\ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSet
public function testSet()
{
$name = 'testName';
$value = 'testValue';
$this->userScopeManager->expects($this->once())->method('set')->with($name, $value);
$this->manager->set($name, $value);
}
示例2: onSuccess
/**
* {@inheritdoc}
*/
protected function onSuccess(User $user)
{
$this->manager->updateUser($user);
if ($this->form->has('inviteUser') && $this->form->has('plainPassword') && $this->form->get('inviteUser')->getViewData() && $this->form->get('plainPassword')->getViewData()) {
try {
$this->sendInviteMail($user, $this->form->get('plainPassword')->getViewData()['first']);
} catch (\Exception $ex) {
$this->logger->error('Invitation email sending failed.', ['exception' => $ex]);
$this->flashBag->add('warning', $this->translator->trans('oro.user.controller.invite.fail.message'));
}
}
// Reloads the user to reset its username. This is needed when the
// username or password have been changed to avoid issues with the
// security layer.
// Additional checking for userConfigManager !== null is added because of API
// to avoid "Call to a member function on a non-object".
$this->manager->reloadUser($user);
if ($this->form->has('signature') && $this->userConfigManager !== null) {
$signature = $this->form->get('signature')->getData();
if ($signature) {
$this->userConfigManager->set('oro_email.signature', $signature);
} else {
$this->userConfigManager->reset('oro_email.signature');
}
$this->userConfigManager->flush();
}
}
示例3: testRegisterWithConfirmation
public function testRegisterWithConfirmation()
{
$this->configManager->set('oro_b2b_account.confirmation_required', true);
$crawler = $this->client->request('GET', $this->getUrl('orob2b_account_frontend_account_user_register'));
$result = $this->client->getResponse();
$this->assertHtmlResponseStatusCodeEquals($result, 200);
$this->submitRegisterForm($crawler, self::EMAIL);
/** @var MessageDataCollector $collector */
$collector = $this->client->getProfile()->getCollector('swiftmailer');
$messages = $collector->getMessages();
/** @var \Swift_Message $message */
$message = reset($messages);
$this->assertInstanceOf('Swift_Message', $message);
$this->assertEquals(self::EMAIL, key($message->getTo()));
$this->assertContains('Confirmation of account registration', $message->getSubject());
$user = $this->getAccountUser(['email' => self::EMAIL]);
$confirmMessage = 'Please follow this link to confirm your email address: <a href="' . trim($this->configManager->get('oro_ui.application_url'), '/') . htmlspecialchars($this->getUrl('orob2b_account_frontend_account_user_confirmation', ['username' => $user->getUsername(), 'token' => $user->getConfirmationToken()])) . '">Confirm</a>';
$this->assertContains($confirmMessage, $message->getBody());
$user = $this->getAccountUser(['email' => self::EMAIL]);
$this->assertNotEmpty($user);
$this->assertTrue($user->isEnabled());
$this->assertFalse($user->isConfirmed());
$crawler = $this->client->followRedirect();
$this->assertEquals('Login', $crawler->filter('h2.title')->html());
$this->assertContains('Please check your email to complete registration', $crawler->html());
$this->client->followRedirects(true);
// Follow confirmation link
$crawler = $this->client->request('GET', $this->getUrl('orob2b_account_frontend_account_user_confirmation', ['username' => $user->getUsername(), 'token' => $user->getConfirmationToken()]));
$result = $this->client->getResponse();
$this->assertHtmlResponseStatusCodeEquals($result, 200);
$this->assertContains('Login', $crawler->html());
$user = $this->getAccountUser(['email' => self::EMAIL]);
$this->assertNotEmpty($user);
$this->assertTrue($user->isEnabled());
$this->assertTrue($user->isConfirmed());
}