szurubooru/src/Entities/Favorite.php

67 lines
1 KiB
PHP
Raw Normal View History

2014-09-27 21:33:31 +02:00
<?php
namespace Szurubooru\Entities;
use Szurubooru\Entities\Post;
use Szurubooru\Entities\User;
2014-09-27 21:33:31 +02:00
2014-10-06 21:09:19 +02:00
final class Favorite extends Entity
2014-09-27 21:33:31 +02:00
{
private $postId;
private $userId;
private $time;
2014-09-27 21:33:31 +02:00
const LAZY_LOADER_USER = 'user';
const LAZY_LOADER_POST = 'post';
public function getUserId()
{
return $this->userId;
}
public function setUserId($userId)
{
$this->userId = $userId;
}
public function getPostId()
{
return $this->postId;
}
public function setPostId($postId)
{
$this->postId = $postId;
}
public function getTime()
{
return $this->time;
}
public function setTime($time)
{
$this->time = $time;
}
2014-09-27 21:33:31 +02:00
public function getUser()
{
return $this->lazyLoad(self::LAZY_LOADER_USER, null);
}
public function setUser(User $user)
2014-09-27 21:33:31 +02:00
{
$this->lazySave(self::LAZY_LOADER_USER, $user);
$this->userId = $user->getId();
}
public function getPost()
{
return $this->lazyLoad(self::LAZY_LOADER_POST, null);
}
public function setPost(Post $post)
2014-09-27 21:33:31 +02:00
{
$this->lazySave(self::LAZY_LOADER_POST, $post);
$this->postId = $post->getId();
}
}