Exemplo n.º 1
0
 /**
  * @param $data
  * @param $userId
  * @param UserInterface $adminUser
  * @return bool
  */
 public function addCoinsForm($data, $userId, UserInterface $adminUser)
 {
     $form = $this->adminCoinForm;
     $form->setData($data);
     if (!$form->isValid()) {
         return false;
     }
     $user = $this->getUser4Id($userId);
     if ($user) {
         $data = $form->getData();
         $this->addCoins($user, $data['coins']);
         $class = $this->entityOptions->getDonateLog();
         /** @var \PServerCore\Entity\DonateLog $donateEntity */
         $donateEntity = new $class();
         $donateEntity->setTransactionId('AdminPanel: ' . $adminUser->getUsername())->setCoins($data['coins'])->setIp($this->ipService->getIp())->setSuccess($donateEntity::STATUS_SUCCESS)->setType($donateEntity::TYPE_INTERNAL)->setUser($user);
         $this->entityManager->persist($donateEntity);
         $this->entityManager->flush();
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * @return \PServerCore\Entity\Repository\DonateLog
  */
 protected function getDonateLogEntity()
 {
     return $this->entityManager->getRepository($this->entityOptions->getDonateLog());
 }