本文整理汇总了PHP中Claroline\CoreBundle\Entity\User::getOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getOptions方法的具体用法?PHP User::getOptions怎么用?PHP User::getOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Claroline\CoreBundle\Entity\User
的用法示例。
在下文中一共展示了User::getOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserOptions
public function getUserOptions(User $user)
{
$options = $user->getOptions();
if (is_null($options)) {
$options = new UserOptions();
$options->setUser($user);
$this->objectManager->persist($options);
$user->setOptions($options);
$this->objectManager->persist($user);
$this->objectManager->flush();
}
return $options;
}
示例2: desktopParametersUserOptionsEditFormAction
/**
* @EXT\Route(
* "/user/options/edit/form",
* name="claro_user_options_edit_form"
* )
*
* @EXT\Template("ClarolineCoreBundle:Tool\desktop\parameters:userOptionsEditForm.html.twig")
* @EXT\ParamConverter("user", options={"authenticatedUser"=true})
*
* Displays the user options form page.
*
* @param \Claroline\CoreBundle\Entity\User $user
* @return Response
*/
public function desktopParametersUserOptionsEditFormAction(User $user)
{
$options = $user->getOptions();
if (is_null($options)) {
$options = new UserOptions();
$options->setUser($user);
$user->setOptions($options);
$this->om->persist($options);
$this->om->persist($user);
$this->om->flush();
}
$form = $this->formFactory->create(new UserOptionsType(), $options);
return array('form' => $form->createView(), 'options' => $options);
}