public function __construct(Video $video)
 {
     $this->video = $video;
     $this->details = $this->getVideoDetails();
     $this->user = DAOFactory::getUserDAO()->findById($video->getUserId());
     $this->videoTO = new VideoTO($this->video, $this->user);
 }
 public function getComments($type, $typeId, $start)
 {
     $span = 10;
     $limit = 10;
     $position = 0;
     if ($start != null) {
         $limit = $start * $span;
         $position = $limit - $span;
     }
     $comments = DAOFactory::getCommentDAO()->findByTypeAndTypeIdAndLimit($type, $typeId, $position, $limit);
     $users = DAOFactory::getUserDAO()->findByCommentTypeAndCommentTypeIdAndLimit($type, $typeId);
     $users = $this->convertToIdMap($users);
     $commentTOs = $this->makeCommentTOs($comments, $users);
     return $commentTOs;
 }
 public function getUser($login)
 {
     return DAOFactory::getUserDAO()->findByLogin($login);
 }
 public function getUsersWithName($name)
 {
     return DAOFactory::getUserDAO()->findByName($name);
 }
 /**
  * Activate existing User.
  * @param string $activeHash
  */
 public function activate($activeHash)
 {
     $user = DAOFactory::getUserDAO()->findByActivation($activeHash);
     $user->setActive(true);
     DAOFactory::getUserDAO()->save($user);
 }
 /**
  * Register new User.
  * @param RegisterFO $fo
  */
 public function register(RegisterFO $fo)
 {
     $user = $this->makeUser($fo);
     DAOFactory::getUserDAO()->save($user);
     $this->sendActivationLink($user);
 }