本文整理汇总了PHP中Claroline\CoreBundle\Entity\User::getPlatformRole方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getPlatformRole方法的具体用法?PHP User::getPlatformRole怎么用?PHP User::getPlatformRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Claroline\CoreBundle\Entity\User
的用法示例。
在下文中一共展示了User::getPlatformRole方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createInwicastUserIfNotExists
public function createInwicastUserIfNotExists(User $user, $token, Mediacenter $mediacenter)
{
$connection = $this->connectionFactory->createConnection($mediacenter->getDatabaseParameters());
$qb = $connection->createQueryBuilder();
$qb->select('usr.username, usr.token')->from('mdcr_inwicast_user_tokens', 'usr')->where('usr.username = :username')->andWhere('usr.tokenapp = :platform')->setParameter("username", $user->getUsername())->setParameter("platform", $this->platformName);
$result = $qb->execute()->fetch();
if (!$result) {
//$qb_insert = $connection->createQueryBuilder();
$sql = "INSERT INTO mdcr_inwicast_user_tokens" . " (`username`, `firstname`, `lastname`, `email`, `userrole`, `token`, `tokendate`, `tokenapp`)" . " VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
$query = $connection->prepare($sql);
$query->bindValue(1, $user->getUsername());
$query->bindValue(2, $user->getFirstName());
$query->bindValue(3, $user->getLastName());
$query->bindValue(4, $user->getMail());
$query->bindValue(5, $user->getPlatformRole()->getName());
$query->bindValue(6, $token);
$query->bindValue(7, date('Y-m-d H:i:s'));
$query->bindValue(8, $this->platformName);
$query->execute();
} else {
$qb_update = $connection->createQueryBuilder();
$qb_update->update('mdcr_inwicast_user_tokens')->set('token', '?')->set('tokendate', '?')->set('tokenapp', '?')->where('username = ?')->setParameter(0, $token)->setParameter(1, date('Y-m-d H:i:s'))->setParameter(2, $this->platformName)->setParameter(3, $user->getUsername());
$qb_update->execute();
}
return true;
}