Example #1
0
 public function handleNewTimeBoard(Request $request, $dateId)
 {
     $course = $request->get('vak');
     $minutes = intval($request->get('minutes'));
     $note = $request->get('note');
     $date = new \DateTime($dateId);
     $board = new TimeBoard();
     $board->setCourse($this->boardManager->getTimeBoardRepository()->getCourseByIdentifier($course));
     $board->setMinutes($minutes);
     $board->setNote($note);
     $board->setDate($date->getTimestamp() * 1000);
     $board->setUser($this->userManager->getCurrentUser());
     //todo: add validation to the board
     $this->boardManager->getTimeBoardRepository()->insertNewTimeBoard($board);
     return new RedirectResponse('/verantwoording/' . $dateId);
 }
 /**
  * @param array $timeBoardData
  * @return TimeBoard
  */
 private function hydrateTimeBoard(array $timeBoardData)
 {
     $timeBoard = new TimeBoard();
     $timeBoard->setId($timeBoardData['id']);
     $timeBoard->setUser($this->userManager->getUserRepository()->getUserByIdentifier($timeBoardData['user_id']));
     $timeBoard->setCourse($this->getCourseByIdentifier($timeBoardData['vak']));
     $timeBoard->setMinutes($timeBoardData['minuten']);
     $timeBoard->setNote($timeBoardData['notitie']);
     $timeBoard->setDate($timeBoardData['datum']);
     return $timeBoard;
 }
 public function registerUser()
 {
     $user = $this->userManager->createUser(['username' => 'dennis', 'password' => 'root']);
     $this->userManager->getUserRepository()->insertNewUser($user);
 }