Continued work on getter/setters: entity IDs
This commit is contained in:
parent
878f09ad0d
commit
7df8a6fa3b
36 changed files with 125 additions and 113 deletions
|
@ -105,7 +105,7 @@ class Access
|
||||||
{
|
{
|
||||||
if (!$user)
|
if (!$user)
|
||||||
return 'all';
|
return 'all';
|
||||||
return $user->id == Auth::getCurrentUser()->id ? 'own' : 'all';
|
return $user->getId() == Auth::getCurrentUser()->getId() ? 'own' : 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAllowedSafety()
|
public static function getAllowedSafety()
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AddCommentJob extends AbstractJob
|
||||||
CommentModel::save($comment);
|
CommentModel::save($comment);
|
||||||
Logger::log('{user} commented on {post}', [
|
Logger::log('{user} commented on {post}', [
|
||||||
'user' => TextHelper::reprUser($user),
|
'user' => TextHelper::reprUser($user),
|
||||||
'post' => TextHelper::reprPost($comment->getPost()->id)]);
|
'post' => TextHelper::reprPost($comment->getPost())]);
|
||||||
|
|
||||||
return $comment;
|
return $comment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ class EditPostRelationsJob extends AbstractPostEditJob
|
||||||
$post = $this->post;
|
$post = $this->post;
|
||||||
$relations = $this->getArgument(self::RELATED_POST_IDS);
|
$relations = $this->getArgument(self::RELATED_POST_IDS);
|
||||||
|
|
||||||
$oldRelatedIds = array_map(function($post) { return $post->id; }, $post->getRelations());
|
$oldRelatedIds = array_map(function($post) { return $post->getId(); }, $post->getRelations());
|
||||||
$post->setRelationsFromText($relations);
|
$post->setRelationsFromText($relations);
|
||||||
$newRelatedIds = array_map(function($post) { return $post->id; }, $post->getRelations());
|
$newRelatedIds = array_map(function($post) { return $post->getId(); }, $post->getRelations());
|
||||||
|
|
||||||
if (!$this->skipSaving)
|
if (!$this->skipSaving)
|
||||||
PostModel::save($post);
|
PostModel::save($post);
|
||||||
|
|
|
@ -19,7 +19,7 @@ class EditUserEmailJob extends AbstractUserEditJob
|
||||||
$user->emailUnconfirmed = $newEmail;
|
$user->emailUnconfirmed = $newEmail;
|
||||||
$user->emailConfirmed = null;
|
$user->emailConfirmed = null;
|
||||||
|
|
||||||
if (Auth::getCurrentUser()->id == $user->id)
|
if (Auth::getCurrentUser()->getId() == $user->getId())
|
||||||
{
|
{
|
||||||
if (!empty($newEmail))
|
if (!empty($newEmail))
|
||||||
ActivateUserEmailJob::sendEmail($user);
|
ActivateUserEmailJob::sendEmail($user);
|
||||||
|
|
|
@ -5,7 +5,7 @@ class FeaturePostJob extends AbstractPostJob
|
||||||
{
|
{
|
||||||
$post = $this->post;
|
$post = $this->post;
|
||||||
|
|
||||||
PropertyModel::set(PropertyModel::FeaturedPostId, $post->id);
|
PropertyModel::set(PropertyModel::FeaturedPostId, $post->getId());
|
||||||
PropertyModel::set(PropertyModel::FeaturedPostDate, time());
|
PropertyModel::set(PropertyModel::FeaturedPostDate, time());
|
||||||
PropertyModel::set(PropertyModel::FeaturedPostUserName, Auth::getCurrentUser()->getName());
|
PropertyModel::set(PropertyModel::FeaturedPostUserName, Auth::getCurrentUser()->getName());
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class GetPostContentJob extends AbstractJob
|
||||||
|
|
||||||
$fileName = sprintf('%s_%s_%s.%s',
|
$fileName = sprintf('%s_%s_%s.%s',
|
||||||
$config->main->title,
|
$config->main->title,
|
||||||
$post->id,
|
$post->getId(),
|
||||||
join(',', array_map(function($tag) { return $tag->getName(); }, $post->getTags())),
|
join(',', array_map(function($tag) { return $tag->getName(); }, $post->getTags())),
|
||||||
TextHelper::resolveMimeType($post->mimeType) ?: 'dat');
|
TextHelper::resolveMimeType($post->mimeType) ?: 'dat');
|
||||||
$fileName = preg_replace('/[[:^print:]]/', '', $fileName);
|
$fileName = preg_replace('/[[:^print:]]/', '', $fileName);
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Auth
|
||||||
private static function getAnonymousUser()
|
private static function getAnonymousUser()
|
||||||
{
|
{
|
||||||
$dummy = UserModel::spawn();
|
$dummy = UserModel::spawn();
|
||||||
$dummy->id = null;
|
$dummy->setId(null);
|
||||||
$dummy->setName(UserModel::getAnonymousName());
|
$dummy->setName(UserModel::getAnonymousName());
|
||||||
$dummy->setAccessRank(new AccessRank(AccessRank::Anonymous));
|
$dummy->setAccessRank(new AccessRank(AccessRank::Anonymous));
|
||||||
return $dummy;
|
return $dummy;
|
||||||
|
|
|
@ -83,7 +83,7 @@ class UserController
|
||||||
|
|
||||||
if ($user->getAccessRank()->toInteger() != AccessRank::Anonymous)
|
if ($user->getAccessRank()->toInteger() != AccessRank::Anonymous)
|
||||||
UserModel::save($user);
|
UserModel::save($user);
|
||||||
if ($user->id == Auth::getCurrentUser()->id)
|
if ($user->getId() == Auth::getCurrentUser()->getId())
|
||||||
Auth::setCurrentUser($user);
|
Auth::setCurrentUser($user);
|
||||||
|
|
||||||
Messenger::message('Browsing settings updated!');
|
Messenger::message('Browsing settings updated!');
|
||||||
|
@ -109,7 +109,7 @@ class UserController
|
||||||
$args = array_filter($args);
|
$args = array_filter($args);
|
||||||
$user = Api::run(new EditUserJob(), $args);
|
$user = Api::run(new EditUserJob(), $args);
|
||||||
|
|
||||||
if (Auth::getCurrentUser()->id == $user->id)
|
if (Auth::getCurrentUser()->getId() == $user->getId())
|
||||||
Auth::setCurrentUser($user);
|
Auth::setCurrentUser($user);
|
||||||
|
|
||||||
$message = 'Account settings updated!';
|
$message = 'Account settings updated!';
|
||||||
|
@ -127,7 +127,7 @@ class UserController
|
||||||
Api::run(new DeleteUserJob(), [
|
Api::run(new DeleteUserJob(), [
|
||||||
DeleteUserJob::USER_NAME => $name]);
|
DeleteUserJob::USER_NAME => $name]);
|
||||||
|
|
||||||
$user = UserModel::findById(Auth::getCurrentUser()->id, false);
|
$user = UserModel::findById(Auth::getCurrentUser()->getId(), false);
|
||||||
if (!$user)
|
if (!$user)
|
||||||
Auth::logOut();
|
Auth::logOut();
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ class UserController
|
||||||
private function requirePasswordConfirmation()
|
private function requirePasswordConfirmation()
|
||||||
{
|
{
|
||||||
$user = getContext()->transport->user;
|
$user = getContext()->transport->user;
|
||||||
if (Auth::getCurrentUser()->id == $user->id)
|
if (Auth::getCurrentUser()->getId() == $user->getId())
|
||||||
{
|
{
|
||||||
$suppliedPassword = InputHelper::get('current-password');
|
$suppliedPassword = InputHelper::get('current-password');
|
||||||
$suppliedPasswordHash = UserModel::hashPassword($suppliedPassword, $user->passSalt);
|
$suppliedPasswordHash = UserModel::hashPassword($suppliedPassword, $user->passSalt);
|
||||||
|
|
|
@ -150,7 +150,7 @@ class TextHelper
|
||||||
{
|
{
|
||||||
if (!is_object($post))
|
if (!is_object($post))
|
||||||
return '@' . $post;
|
return '@' . $post;
|
||||||
return '@' . $post->id;
|
return '@' . $post->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function reprUser($user)
|
public static function reprUser($user)
|
||||||
|
|
|
@ -126,7 +126,7 @@ abstract class AbstractCrudModel implements IModel
|
||||||
$table = static::getTableName();
|
$table = static::getTableName();
|
||||||
if (!Database::inTransaction())
|
if (!Database::inTransaction())
|
||||||
throw new Exception('Can be run only within transaction');
|
throw new Exception('Can be run only within transaction');
|
||||||
if (!$entity->id)
|
if (!$entity->getId())
|
||||||
{
|
{
|
||||||
$stmt = new Sql\InsertStatement();
|
$stmt = new Sql\InsertStatement();
|
||||||
$stmt->setTable($table);
|
$stmt->setTable($table);
|
||||||
|
@ -139,7 +139,7 @@ abstract class AbstractCrudModel implements IModel
|
||||||
$stmt->setColumn($key, new Sql\Binding($val));
|
$stmt->setColumn($key, new Sql\Binding($val));
|
||||||
}
|
}
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
$entity->id = (int) Database::lastInsertId();
|
$entity->setId((int) Database::lastInsertId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class CommentModel extends AbstractCrudModel
|
||||||
|
|
||||||
$stmt = new Sql\UpdateStatement();
|
$stmt = new Sql\UpdateStatement();
|
||||||
$stmt->setTable('comment');
|
$stmt->setTable('comment');
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($comment->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($comment->getId())));
|
||||||
|
|
||||||
foreach ($bindings as $key => $val)
|
foreach ($bindings as $key => $val)
|
||||||
$stmt->setColumn($key, new Sql\Binding($val));
|
$stmt->setColumn($key, new Sql\Binding($val));
|
||||||
|
@ -49,7 +49,7 @@ class CommentModel extends AbstractCrudModel
|
||||||
{
|
{
|
||||||
$stmt = new Sql\DeleteStatement();
|
$stmt = new Sql\DeleteStatement();
|
||||||
$stmt->setTable('comment');
|
$stmt->setTable('comment');
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($comment->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($comment->getId())));
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class CommentModel extends AbstractCrudModel
|
||||||
{
|
{
|
||||||
self::preloadOneToMany($comments,
|
self::preloadOneToMany($comments,
|
||||||
function($comment) { return $comment->commenterId; },
|
function($comment) { return $comment->commenterId; },
|
||||||
function($user) { return $user->id; },
|
function($user) { return $user->getId(); },
|
||||||
function($userIds) { return UserModel::findByIds($userIds); },
|
function($userIds) { return UserModel::findByIds($userIds); },
|
||||||
function($comment, $user) { return $comment->setCache('commenter', $user); });
|
function($comment, $user) { return $comment->setCache('commenter', $user); });
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class CommentModel extends AbstractCrudModel
|
||||||
{
|
{
|
||||||
self::preloadOneToMany($comments,
|
self::preloadOneToMany($comments,
|
||||||
function($comment) { return $comment->postId; },
|
function($comment) { return $comment->postId; },
|
||||||
function($post) { return $post->id; },
|
function($post) { return $post->getId(); },
|
||||||
function($postIds) { return PostModel::findByIds($postIds); },
|
function($postIds) { return PostModel::findByIds($postIds); },
|
||||||
function($comment, $post) { $comment->setCache('post', $post); });
|
function($comment, $post) { $comment->setCache('post', $post); });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
abstract class AbstractEntity implements IValidatable
|
abstract class AbstractEntity implements IValidatable
|
||||||
{
|
{
|
||||||
public $id;
|
protected $id;
|
||||||
protected $__cache = [];
|
protected $__cache = [];
|
||||||
|
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setId($id)
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
}
|
||||||
|
|
||||||
public function resetCache()
|
public function resetCache()
|
||||||
{
|
{
|
||||||
$this->__cache = [];
|
$this->__cache = [];
|
||||||
|
|
|
@ -39,7 +39,7 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
|
|
||||||
public function setUploader($user)
|
public function setUploader($user)
|
||||||
{
|
{
|
||||||
$this->uploaderId = $user->id;
|
$this->uploaderId = $user->getId();
|
||||||
$this->setCache('uploader', $user);
|
$this->setCache('uploader', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
{
|
{
|
||||||
if ($this->hasCache('comments'))
|
if ($this->hasCache('comments'))
|
||||||
return $this->getCache('comments');
|
return $this->getCache('comments');
|
||||||
$comments = CommentModel::findAllByPostId($this->id);
|
$comments = CommentModel::findAllByPostId($this->getId());
|
||||||
$this->setCache('comments', $comments);
|
$this->setCache('comments', $comments);
|
||||||
return $comments;
|
return $comments;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
$stmt->setColumn('user.*');
|
$stmt->setColumn('user.*');
|
||||||
$stmt->setTable('user');
|
$stmt->setTable('user');
|
||||||
$stmt->addInnerJoin('favoritee', new Sql\EqualsFunctor('favoritee.user_id', 'user.id'));
|
$stmt->addInnerJoin('favoritee', new Sql\EqualsFunctor('favoritee.user_id', 'user.id'));
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('favoritee.post_id', new Sql\Binding($this->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('favoritee.post_id', new Sql\Binding($this->getId())));
|
||||||
$rows = Database::fetchAll($stmt);
|
$rows = Database::fetchAll($stmt);
|
||||||
$favorites = UserModel::convertRows($rows);
|
$favorites = UserModel::convertRows($rows);
|
||||||
$this->setCache('favoritee', $favorites);
|
$this->setCache('favoritee', $favorites);
|
||||||
|
@ -75,7 +75,7 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
$stmt = new Sql\SelectStatement();
|
$stmt = new Sql\SelectStatement();
|
||||||
$stmt->setColumn('post.*');
|
$stmt->setColumn('post.*');
|
||||||
$stmt->setTable('post');
|
$stmt->setTable('post');
|
||||||
$binding = new Sql\Binding($this->id);
|
$binding = new Sql\Binding($this->getId());
|
||||||
$stmt->addInnerJoin('crossref', (new Sql\DisjunctionFunctor)
|
$stmt->addInnerJoin('crossref', (new Sql\DisjunctionFunctor)
|
||||||
->add(
|
->add(
|
||||||
(new Sql\ConjunctionFunctor)
|
(new Sql\ConjunctionFunctor)
|
||||||
|
@ -94,11 +94,11 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
public function setRelations(array $relations)
|
public function setRelations(array $relations)
|
||||||
{
|
{
|
||||||
foreach ($relations as $relatedPost)
|
foreach ($relations as $relatedPost)
|
||||||
if (!$relatedPost->id)
|
if (!$relatedPost->getId())
|
||||||
throw new Exception('All related posts must be saved');
|
throw new Exception('All related posts must be saved');
|
||||||
$uniqueRelations = [];
|
$uniqueRelations = [];
|
||||||
foreach ($relations as $relatedPost)
|
foreach ($relations as $relatedPost)
|
||||||
$uniqueRelations[$relatedPost->id] = $relatedPost;
|
$uniqueRelations[$relatedPost->getId()] = $relatedPost;
|
||||||
$relations = array_values($uniqueRelations);
|
$relations = array_values($uniqueRelations);
|
||||||
$this->setCache('relations', $relations);
|
$this->setCache('relations', $relations);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
$relatedPosts = [];
|
$relatedPosts = [];
|
||||||
foreach ($relatedIds as $relatedId)
|
foreach ($relatedIds as $relatedId)
|
||||||
{
|
{
|
||||||
if ($relatedId == $this->id)
|
if ($relatedId == $this->getId())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (count($relatedPosts) > $config->browsing->maxRelatedPosts)
|
if (count($relatedPosts) > $config->browsing->maxRelatedPosts)
|
||||||
|
@ -131,7 +131,7 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
{
|
{
|
||||||
if ($this->hasCache('tags'))
|
if ($this->hasCache('tags'))
|
||||||
return $this->getCache('tags');
|
return $this->getCache('tags');
|
||||||
$tags = TagModel::findAllByPostId($this->id);
|
$tags = TagModel::findAllByPostId($this->getId());
|
||||||
$this->setCache('tags', $tags);
|
$this->setCache('tags', $tags);
|
||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
@ -139,11 +139,11 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
public function setTags(array $tags)
|
public function setTags(array $tags)
|
||||||
{
|
{
|
||||||
foreach ($tags as $tag)
|
foreach ($tags as $tag)
|
||||||
if (!$tag->id)
|
if (!$tag->getId())
|
||||||
throw new Exception('All tags must be saved');
|
throw new Exception('All tags must be saved');
|
||||||
$uniqueTags = [];
|
$uniqueTags = [];
|
||||||
foreach ($tags as $tag)
|
foreach ($tags as $tag)
|
||||||
$uniqueTags[$tag->id] = $tag;
|
$uniqueTags[$tag->getId()] = $tag;
|
||||||
$tags = array_values($uniqueTags);
|
$tags = array_values($uniqueTags);
|
||||||
$this->setCache('tags', $tags);
|
$this->setCache('tags', $tags);
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
}
|
}
|
||||||
|
|
||||||
$duplicatedPost = PostModel::findByHash($this->fileHash, false);
|
$duplicatedPost = PostModel::findByHash($this->fileHash, false);
|
||||||
if ($duplicatedPost !== null and (!$this->id or $this->id != $duplicatedPost->id))
|
if ($duplicatedPost !== null and (!$this->getId() or $this->getId() != $duplicatedPost->getId()))
|
||||||
{
|
{
|
||||||
throw new SimpleException(
|
throw new SimpleException(
|
||||||
'Duplicate upload: %s',
|
'Duplicate upload: %s',
|
||||||
|
@ -361,7 +361,7 @@ class PostEntity extends AbstractEntity implements IValidatable
|
||||||
unlink($thumbPath);
|
unlink($thumbPath);
|
||||||
|
|
||||||
$duplicatedPost = PostModel::findByHash($youtubeId, false);
|
$duplicatedPost = PostModel::findByHash($youtubeId, false);
|
||||||
if ($duplicatedPost !== null and (!$this->id or $this->id != $duplicatedPost->id))
|
if ($duplicatedPost !== null and (!$this->getId() or $this->getId() != $duplicatedPost->getId()))
|
||||||
{
|
{
|
||||||
throw new SimpleException(
|
throw new SimpleException(
|
||||||
'Duplicate upload: %s',
|
'Duplicate upload: %s',
|
||||||
|
|
|
@ -29,7 +29,7 @@ class TagEntity extends AbstractEntity implements IValidatable
|
||||||
$stmt = new Sql\SelectStatement();
|
$stmt = new Sql\SelectStatement();
|
||||||
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
||||||
$stmt->setTable('post_tag');
|
$stmt->setTable('post_tag');
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('tag_id', new Sql\Binding($this->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('tag_id', new Sql\Binding($this->getId())));
|
||||||
return Database::fetchOne($stmt)['count'];
|
return Database::fetchOne($stmt)['count'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ class TokenEntity extends AbstractEntity implements IValidatable
|
||||||
|
|
||||||
public function setUser($user)
|
public function setUser($user)
|
||||||
{
|
{
|
||||||
$this->userId = $user ? $user->id : null;
|
$this->userId = $user ? $user->getId() : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,8 +172,8 @@ class UserEntity extends AbstractEntity implements IValidatable
|
||||||
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
||||||
$stmt->setTable('favoritee');
|
$stmt->setTable('favoritee');
|
||||||
$stmt->setCriterion((new Sql\ConjunctionFunctor)
|
$stmt->setCriterion((new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('user_id', new Sql\Binding($this->id)))
|
->add(new Sql\EqualsFunctor('user_id', new Sql\Binding($this->getId())))
|
||||||
->add(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->id))));
|
->add(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->getId()))));
|
||||||
return Database::fetchOne($stmt)['count'] == 1;
|
return Database::fetchOne($stmt)['count'] == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,8 +183,8 @@ class UserEntity extends AbstractEntity implements IValidatable
|
||||||
$stmt->setColumn('score');
|
$stmt->setColumn('score');
|
||||||
$stmt->setTable('post_score');
|
$stmt->setTable('post_score');
|
||||||
$stmt->setCriterion((new Sql\ConjunctionFunctor)
|
$stmt->setCriterion((new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('user_id', new Sql\Binding($this->id)))
|
->add(new Sql\EqualsFunctor('user_id', new Sql\Binding($this->getId())))
|
||||||
->add(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->id))));
|
->add(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->getId()))));
|
||||||
$row = Database::fetchOne($stmt);
|
$row = Database::fetchOne($stmt);
|
||||||
if ($row)
|
if ($row)
|
||||||
return intval($row['score']);
|
return intval($row['score']);
|
||||||
|
@ -196,7 +196,7 @@ class UserEntity extends AbstractEntity implements IValidatable
|
||||||
$stmt = new Sql\SelectStatement();
|
$stmt = new Sql\SelectStatement();
|
||||||
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
||||||
$stmt->setTable('favoritee');
|
$stmt->setTable('favoritee');
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('user_id', new Sql\Binding($this->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('user_id', new Sql\Binding($this->getId())));
|
||||||
return Database::fetchOne($stmt)['count'];
|
return Database::fetchOne($stmt)['count'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ class UserEntity extends AbstractEntity implements IValidatable
|
||||||
$stmt = new Sql\SelectStatement();
|
$stmt = new Sql\SelectStatement();
|
||||||
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
||||||
$stmt->setTable('comment');
|
$stmt->setTable('comment');
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('commenter_id', new Sql\Binding($this->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('commenter_id', new Sql\Binding($this->getId())));
|
||||||
return Database::fetchOne($stmt)['count'];
|
return Database::fetchOne($stmt)['count'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ class UserEntity extends AbstractEntity implements IValidatable
|
||||||
$stmt = new Sql\SelectStatement();
|
$stmt = new Sql\SelectStatement();
|
||||||
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
$stmt->setColumn(new Sql\AliasFunctor(new Sql\CountFunctor('1'), 'count'));
|
||||||
$stmt->setTable('post');
|
$stmt->setTable('post');
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('uploader_id', new Sql\Binding($this->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('uploader_id', new Sql\Binding($this->getId())));
|
||||||
return Database::fetchOne($stmt)['count'];
|
return Database::fetchOne($stmt)['count'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ class PostModel extends AbstractCrudModel
|
||||||
foreach ($bindings as $key => $value)
|
foreach ($bindings as $key => $value)
|
||||||
$stmt->setColumn($key, new Sql\Binding($value));
|
$stmt->setColumn($key, new Sql\Binding($value));
|
||||||
|
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($post->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($post->getId())));
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
|
|
||||||
//tags
|
//tags
|
||||||
|
@ -81,15 +81,15 @@ class PostModel extends AbstractCrudModel
|
||||||
|
|
||||||
$stmt = new Sql\DeleteStatement();
|
$stmt = new Sql\DeleteStatement();
|
||||||
$stmt->setTable('post_tag');
|
$stmt->setTable('post_tag');
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->getId())));
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
|
|
||||||
foreach ($tags as $postTag)
|
foreach ($tags as $postTag)
|
||||||
{
|
{
|
||||||
$stmt = new Sql\InsertStatement();
|
$stmt = new Sql\InsertStatement();
|
||||||
$stmt->setTable('post_tag');
|
$stmt->setTable('post_tag');
|
||||||
$stmt->setColumn('post_id', new Sql\Binding($post->id));
|
$stmt->setColumn('post_id', new Sql\Binding($post->getId()));
|
||||||
$stmt->setColumn('tag_id', new Sql\Binding($postTag->id));
|
$stmt->setColumn('tag_id', new Sql\Binding($postTag->getId()));
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class PostModel extends AbstractCrudModel
|
||||||
|
|
||||||
$stmt = new Sql\DeleteStatement();
|
$stmt = new Sql\DeleteStatement();
|
||||||
$stmt->setTable('crossref');
|
$stmt->setTable('crossref');
|
||||||
$binding = new Sql\Binding($post->id);
|
$binding = new Sql\Binding($post->getId());
|
||||||
$stmt->setCriterion((new Sql\DisjunctionFunctor)
|
$stmt->setCriterion((new Sql\DisjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('post_id', $binding))
|
->add(new Sql\EqualsFunctor('post_id', $binding))
|
||||||
->add(new Sql\EqualsFunctor('post2_id', $binding)));
|
->add(new Sql\EqualsFunctor('post2_id', $binding)));
|
||||||
|
@ -108,8 +108,8 @@ class PostModel extends AbstractCrudModel
|
||||||
{
|
{
|
||||||
$stmt = new Sql\InsertStatement();
|
$stmt = new Sql\InsertStatement();
|
||||||
$stmt->setTable('crossref');
|
$stmt->setTable('crossref');
|
||||||
$stmt->setColumn('post_id', new Sql\Binding($post->id));
|
$stmt->setColumn('post_id', new Sql\Binding($post->getId()));
|
||||||
$stmt->setColumn('post2_id', new Sql\Binding($relatedPost->id));
|
$stmt->setColumn('post2_id', new Sql\Binding($relatedPost->getId()));
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -121,7 +121,7 @@ class PostModel extends AbstractCrudModel
|
||||||
{
|
{
|
||||||
Database::transaction(function() use ($post)
|
Database::transaction(function() use ($post)
|
||||||
{
|
{
|
||||||
$binding = new Sql\Binding($post->id);
|
$binding = new Sql\Binding($post->getId());
|
||||||
|
|
||||||
$stmt = new Sql\DeleteStatement();
|
$stmt = new Sql\DeleteStatement();
|
||||||
$stmt->setTable('post_score');
|
$stmt->setTable('post_score');
|
||||||
|
@ -204,7 +204,7 @@ class PostModel extends AbstractCrudModel
|
||||||
$tagsMap = [];
|
$tagsMap = [];
|
||||||
foreach ($posts as $post)
|
foreach ($posts as $post)
|
||||||
{
|
{
|
||||||
$postId = $post->id;
|
$postId = $post->getId();
|
||||||
$postMap[$postId] = $post;
|
$postMap[$postId] = $post;
|
||||||
$commentMap[$postId] = [];
|
$commentMap[$postId] = [];
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ class PostModel extends AbstractCrudModel
|
||||||
$tagsMap = [];
|
$tagsMap = [];
|
||||||
foreach ($posts as $post)
|
foreach ($posts as $post)
|
||||||
{
|
{
|
||||||
$postId = $post->id;
|
$postId = $post->getId();
|
||||||
$postMap[$postId] = $post;
|
$postMap[$postId] = $post;
|
||||||
$tagsMap[$postId] = [];
|
$tagsMap[$postId] = [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
$innerStmt->setTable('post_tag');
|
$innerStmt->setTable('post_tag');
|
||||||
$innerStmt->setCriterion((new Sql\ConjunctionFunctor)
|
$innerStmt->setCriterion((new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('post_tag.post_id', 'post.id'))
|
->add(new Sql\EqualsFunctor('post_tag.post_id', 'post.id'))
|
||||||
->add(new Sql\EqualsFunctor('post_tag.tag_id', new Sql\Binding($tag->id))));
|
->add(new Sql\EqualsFunctor('post_tag.tag_id', new Sql\Binding($tag->getId()))));
|
||||||
$operator = new Sql\ExistsFunctor($innerStmt);
|
$operator = new Sql\ExistsFunctor($innerStmt);
|
||||||
if ($neg)
|
if ($neg)
|
||||||
$operator = new Sql\NegationFunctor($operator);
|
$operator = new Sql\NegationFunctor($operator);
|
||||||
|
@ -78,7 +78,7 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
->setTable('favoritee')
|
->setTable('favoritee')
|
||||||
->setCriterion((new Sql\ConjunctionFunctor)
|
->setCriterion((new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('favoritee.post_id', 'post.id'))
|
->add(new Sql\EqualsFunctor('favoritee.post_id', 'post.id'))
|
||||||
->add(new Sql\EqualsFunctor('favoritee.user_id', new Sql\Binding($user->id))));
|
->add(new Sql\EqualsFunctor('favoritee.user_id', new Sql\Binding($user->getId()))));
|
||||||
return new Sql\ExistsFunctor($innerStmt);
|
return new Sql\ExistsFunctor($innerStmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,14 +89,14 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
->setTable('comment')
|
->setTable('comment')
|
||||||
->setCriterion((new Sql\ConjunctionFunctor)
|
->setCriterion((new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('comment.post_id', 'post.id'))
|
->add(new Sql\EqualsFunctor('comment.post_id', 'post.id'))
|
||||||
->add(new Sql\EqualsFunctor('comment.commenter_id', new Sql\Binding($user->id))));
|
->add(new Sql\EqualsFunctor('comment.commenter_id', new Sql\Binding($user->getId()))));
|
||||||
return new Sql\ExistsFunctor($innerStmt);
|
return new Sql\ExistsFunctor($innerStmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif (in_array($key, ['submit', 'upload', 'uploads', 'uploader', 'uploaded']))
|
elseif (in_array($key, ['submit', 'upload', 'uploads', 'uploader', 'uploaded']))
|
||||||
{
|
{
|
||||||
$user = UserModel::findByNameOrEmail($value);
|
$user = UserModel::findByNameOrEmail($value);
|
||||||
return new Sql\EqualsFunctor('post.uploader_id', new Sql\Binding($user->id));
|
return new Sql\EqualsFunctor('post.uploader_id', new Sql\Binding($user->getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif (in_array($key, ['idmin', 'id_min']))
|
elseif (in_array($key, ['idmin', 'id_min']))
|
||||||
|
@ -165,7 +165,7 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
{
|
{
|
||||||
$this->statement->addLeftOuterJoin('post_score', (new Sql\ConjunctionFunctor)
|
$this->statement->addLeftOuterJoin('post_score', (new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('post_score.post_id', 'post.id'))
|
->add(new Sql\EqualsFunctor('post_score.post_id', 'post.id'))
|
||||||
->add(new Sql\EqualsFunctor('post_score.user_id', new Sql\Binding($activeUser->id))));
|
->add(new Sql\EqualsFunctor('post_score.user_id', new Sql\Binding($activeUser->getId()))));
|
||||||
}
|
}
|
||||||
return new Sql\EqualsFunctor(new Sql\IfNullFunctor('post_score.score', '0'), '1');
|
return new Sql\EqualsFunctor(new Sql\IfNullFunctor('post_score.score', '0'), '1');
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
{
|
{
|
||||||
$this->statement->addLeftOuterJoin('post_score', (new Sql\ConjunctionFunctor)
|
$this->statement->addLeftOuterJoin('post_score', (new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('post_score.post_id', 'post.id'))
|
->add(new Sql\EqualsFunctor('post_score.post_id', 'post.id'))
|
||||||
->add(new Sql\EqualsFunctor('post_score.user_id', new Sql\Binding($activeUser->id))));
|
->add(new Sql\EqualsFunctor('post_score.user_id', new Sql\Binding($activeUser->getId()))));
|
||||||
}
|
}
|
||||||
return new Sql\EqualsFunctor(new Sql\IfNullFunctor('post_score.score', '0'), '-1');
|
return new Sql\EqualsFunctor(new Sql\IfNullFunctor('post_score.score', '0'), '-1');
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class TagSearchService extends AbstractSearchService
|
||||||
$parentTagEntity = TagModel::findByName($parentTagName, false);
|
$parentTagEntity = TagModel::findByName($parentTagName, false);
|
||||||
if (empty($parentTagEntity))
|
if (empty($parentTagEntity))
|
||||||
return [];
|
return [];
|
||||||
$parentTagId = $parentTagEntity->id;
|
$parentTagId = $parentTagEntity->getId();
|
||||||
|
|
||||||
//get tags that appear with selected tag along with their occurence frequency
|
//get tags that appear with selected tag along with their occurence frequency
|
||||||
$stmt = (new Sql\SelectStatement)
|
$stmt = (new Sql\SelectStatement)
|
||||||
|
|
|
@ -28,7 +28,7 @@ class TagModel extends AbstractCrudModel
|
||||||
$stmt = new Sql\UpdateStatement();
|
$stmt = new Sql\UpdateStatement();
|
||||||
$stmt->setTable('tag');
|
$stmt->setTable('tag');
|
||||||
$stmt->setColumn('name', new Sql\Binding($tag->getName()));
|
$stmt->setColumn('name', new Sql\Binding($tag->getName()));
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($tag->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($tag->getId())));
|
||||||
|
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
});
|
});
|
||||||
|
@ -38,7 +38,7 @@ class TagModel extends AbstractCrudModel
|
||||||
|
|
||||||
public static function remove($tag)
|
public static function remove($tag)
|
||||||
{
|
{
|
||||||
$binding = new Sql\Binding($tag->id);
|
$binding = new Sql\Binding($tag->getId());
|
||||||
|
|
||||||
$stmt = new Sql\DeleteStatement();
|
$stmt = new Sql\DeleteStatement();
|
||||||
$stmt->setTable('post_tag');
|
$stmt->setTable('post_tag');
|
||||||
|
@ -58,7 +58,7 @@ class TagModel extends AbstractCrudModel
|
||||||
$sourceTag = TagModel::findByName($sourceName);
|
$sourceTag = TagModel::findByName($sourceName);
|
||||||
$targetTag = TagModel::findByName($targetName, false);
|
$targetTag = TagModel::findByName($targetName, false);
|
||||||
|
|
||||||
if ($targetTag and $targetTag->id != $sourceTag->id)
|
if ($targetTag and $targetTag->getId() != $sourceTag->getId())
|
||||||
throw new SimpleException('Target tag already exists');
|
throw new SimpleException('Target tag already exists');
|
||||||
|
|
||||||
$sourceTag->setName($targetName);
|
$sourceTag->setName($targetName);
|
||||||
|
@ -74,7 +74,7 @@ class TagModel extends AbstractCrudModel
|
||||||
$sourceTag = TagModel::findByName($sourceName);
|
$sourceTag = TagModel::findByName($sourceName);
|
||||||
$targetTag = TagModel::findByName($targetName);
|
$targetTag = TagModel::findByName($targetName);
|
||||||
|
|
||||||
if ($sourceTag->id == $targetTag->id)
|
if ($sourceTag->getId() == $targetTag->getId())
|
||||||
throw new SimpleException('Source and target tag are the same');
|
throw new SimpleException('Source and target tag are the same');
|
||||||
|
|
||||||
$stmt = new Sql\SelectStatement();
|
$stmt = new Sql\SelectStatement();
|
||||||
|
@ -89,7 +89,7 @@ class TagModel extends AbstractCrudModel
|
||||||
->setCriterion(
|
->setCriterion(
|
||||||
(new Sql\ConjunctionFunctor)
|
(new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('post_tag.post_id', 'post.id'))
|
->add(new Sql\EqualsFunctor('post_tag.post_id', 'post.id'))
|
||||||
->add(new Sql\EqualsFunctor('post_tag.tag_id', new Sql\Binding($sourceTag->id))))))
|
->add(new Sql\EqualsFunctor('post_tag.tag_id', new Sql\Binding($sourceTag->getId()))))))
|
||||||
->add(
|
->add(
|
||||||
new Sql\NegationFunctor(
|
new Sql\NegationFunctor(
|
||||||
new Sql\ExistsFunctor(
|
new Sql\ExistsFunctor(
|
||||||
|
@ -98,7 +98,7 @@ class TagModel extends AbstractCrudModel
|
||||||
->setCriterion(
|
->setCriterion(
|
||||||
(new Sql\ConjunctionFunctor)
|
(new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('post_tag.post_id', 'post.id'))
|
->add(new Sql\EqualsFunctor('post_tag.post_id', 'post.id'))
|
||||||
->add(new Sql\EqualsFunctor('post_tag.tag_id', new Sql\Binding($targetTag->id))))))));
|
->add(new Sql\EqualsFunctor('post_tag.tag_id', new Sql\Binding($targetTag->getId()))))))));
|
||||||
$rows = Database::fetchAll($stmt);
|
$rows = Database::fetchAll($stmt);
|
||||||
$postIds = array_map(function($row) { return $row['id']; }, $rows);
|
$postIds = array_map(function($row) { return $row['id']; }, $rows);
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class TagModel extends AbstractCrudModel
|
||||||
$stmt = new Sql\InsertStatement();
|
$stmt = new Sql\InsertStatement();
|
||||||
$stmt->setTable('post_tag');
|
$stmt->setTable('post_tag');
|
||||||
$stmt->setColumn('post_id', new Sql\Binding($postId));
|
$stmt->setColumn('post_id', new Sql\Binding($postId));
|
||||||
$stmt->setColumn('tag_id', new Sql\Binding($targetTag->id));
|
$stmt->setColumn('tag_id', new Sql\Binding($targetTag->getId()));
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,7 +26,7 @@ class TokenModel extends AbstractCrudModel
|
||||||
|
|
||||||
$stmt = new Sql\UpdateStatement();
|
$stmt = new Sql\UpdateStatement();
|
||||||
$stmt->setTable('user_token');
|
$stmt->setTable('user_token');
|
||||||
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($token->id)));
|
$stmt->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($token->getId())));
|
||||||
|
|
||||||
foreach ($bindings as $key => $val)
|
foreach ($bindings as $key => $val)
|
||||||
$stmt->setColumn($key, new Sql\Binding($val));
|
$stmt->setColumn($key, new Sql\Binding($val));
|
||||||
|
|
|
@ -56,7 +56,7 @@ class UserModel extends AbstractCrudModel
|
||||||
|
|
||||||
$stmt = (new Sql\UpdateStatement)
|
$stmt = (new Sql\UpdateStatement)
|
||||||
->setTable('user')
|
->setTable('user')
|
||||||
->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($user->id)));
|
->setCriterion(new Sql\EqualsFunctor('id', new Sql\Binding($user->getId())));
|
||||||
|
|
||||||
foreach ($bindings as $key => $val)
|
foreach ($bindings as $key => $val)
|
||||||
$stmt->setColumn($key, new Sql\Binding($val));
|
$stmt->setColumn($key, new Sql\Binding($val));
|
||||||
|
@ -71,7 +71,7 @@ class UserModel extends AbstractCrudModel
|
||||||
{
|
{
|
||||||
Database::transaction(function() use ($user)
|
Database::transaction(function() use ($user)
|
||||||
{
|
{
|
||||||
$binding = new Sql\Binding($user->id);
|
$binding = new Sql\Binding($user->getId());
|
||||||
|
|
||||||
$stmt = new Sql\DeleteStatement();
|
$stmt = new Sql\DeleteStatement();
|
||||||
$stmt->setTable('post_score');
|
$stmt->setTable('post_score');
|
||||||
|
@ -144,16 +144,16 @@ class UserModel extends AbstractCrudModel
|
||||||
$stmt = new Sql\DeleteStatement();
|
$stmt = new Sql\DeleteStatement();
|
||||||
$stmt->setTable('post_score');
|
$stmt->setTable('post_score');
|
||||||
$stmt->setCriterion((new Sql\ConjunctionFunctor)
|
$stmt->setCriterion((new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->id)))
|
->add(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->getId())))
|
||||||
->add(new Sql\EqualsFunctor('user_id', new Sql\Binding($user->id))));
|
->add(new Sql\EqualsFunctor('user_id', new Sql\Binding($user->getId()))));
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
$score = intval($score);
|
$score = intval($score);
|
||||||
if ($score != 0)
|
if ($score != 0)
|
||||||
{
|
{
|
||||||
$stmt = new Sql\InsertStatement();
|
$stmt = new Sql\InsertStatement();
|
||||||
$stmt->setTable('post_score');
|
$stmt->setTable('post_score');
|
||||||
$stmt->setColumn('post_id', new Sql\Binding($post->id));
|
$stmt->setColumn('post_id', new Sql\Binding($post->getId()));
|
||||||
$stmt->setColumn('user_id', new Sql\Binding($user->id));
|
$stmt->setColumn('user_id', new Sql\Binding($user->getId()));
|
||||||
$stmt->setColumn('score', new Sql\Binding($score));
|
$stmt->setColumn('score', new Sql\Binding($score));
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,8 @@ class UserModel extends AbstractCrudModel
|
||||||
self::removeFromUserFavorites($user, $post);
|
self::removeFromUserFavorites($user, $post);
|
||||||
$stmt = new Sql\InsertStatement();
|
$stmt = new Sql\InsertStatement();
|
||||||
$stmt->setTable('favoritee');
|
$stmt->setTable('favoritee');
|
||||||
$stmt->setColumn('post_id', new Sql\Binding($post->id));
|
$stmt->setColumn('post_id', new Sql\Binding($post->getId()));
|
||||||
$stmt->setColumn('user_id', new Sql\Binding($user->id));
|
$stmt->setColumn('user_id', new Sql\Binding($user->getId()));
|
||||||
$stmt->setColumn('fav_date', time());
|
$stmt->setColumn('fav_date', time());
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
});
|
});
|
||||||
|
@ -181,8 +181,8 @@ class UserModel extends AbstractCrudModel
|
||||||
$stmt = new Sql\DeleteStatement();
|
$stmt = new Sql\DeleteStatement();
|
||||||
$stmt->setTable('favoritee');
|
$stmt->setTable('favoritee');
|
||||||
$stmt->setCriterion((new Sql\ConjunctionFunctor)
|
$stmt->setCriterion((new Sql\ConjunctionFunctor)
|
||||||
->add(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->id)))
|
->add(new Sql\EqualsFunctor('post_id', new Sql\Binding($post->getId())))
|
||||||
->add(new Sql\EqualsFunctor('user_id', new Sql\Binding($user->id))));
|
->add(new Sql\EqualsFunctor('user_id', new Sql\Binding($user->getId()))));
|
||||||
Database::exec($stmt);
|
Database::exec($stmt);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ class UserModel extends AbstractCrudModel
|
||||||
$config = getConfig();
|
$config = getConfig();
|
||||||
|
|
||||||
$otherUser = self::findByName($userName, false);
|
$otherUser = self::findByName($userName, false);
|
||||||
if ($otherUser !== null and $otherUser->id != $user->id)
|
if ($otherUser !== null and $otherUser->getId() != $user->getId())
|
||||||
{
|
{
|
||||||
if (!$otherUser->emailConfirmed and $config->registration->needEmailForRegistering)
|
if (!$otherUser->emailConfirmed and $config->registration->needEmailForRegistering)
|
||||||
throw new SimpleException('User with this name is already registered and awaits e-mail confirmation');
|
throw new SimpleException('User with this name is already registered and awaits e-mail confirmation');
|
||||||
|
|
|
@ -16,7 +16,7 @@ Assets::addScript('comment-edit.js');
|
||||||
<div class="input-wrapper"><textarea name="text" cols="50" rows="3"></textarea></div>
|
<div class="input-wrapper"><textarea name="text" cols="50" rows="3"></textarea></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="post-id" value="<?= $this->context->transport->post->id ?>">
|
<input type="hidden" name="post-id" value="<?= $this->context->transport->post->getId() ?>">
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<button name="sender" class="submit" type="submit" value="preview">Preview</button>
|
<button name="sender" class="submit" type="submit" value="preview">Preview</button>
|
||||||
|
|
|
@ -7,7 +7,7 @@ Assets::addScript('comment-edit.js');
|
||||||
method="post"
|
method="post"
|
||||||
action="<?= \Chibi\Router::linkTo(
|
action="<?= \Chibi\Router::linkTo(
|
||||||
['CommentController', 'editAction'],
|
['CommentController', 'editAction'],
|
||||||
['id' => $this->context->transport->comment->id]) ?>"
|
['id' => $this->context->transport->comment->getId()]) ?>"
|
||||||
class="edit-comment">
|
class="edit-comment">
|
||||||
|
|
||||||
<h1>edit comment</h1>
|
<h1>edit comment</h1>
|
||||||
|
|
|
@ -33,7 +33,7 @@ Assets::setSubTitle('comments');
|
||||||
<?php if (count($comments) > count($commentsToDisplay)): ?>
|
<?php if (count($comments) > count($commentsToDisplay)): ?>
|
||||||
<a href="<?= \Chibi\Router::linkTo(
|
<a href="<?= \Chibi\Router::linkTo(
|
||||||
['PostController', 'genericView'],
|
['PostController', 'genericView'],
|
||||||
['id' => $this->context->post->id]) ?>">
|
['id' => $this->context->post->getId()]) ?>">
|
||||||
<span class="hellip">(more…)</span>
|
<span class="hellip">(more…)</span>
|
||||||
</a>
|
</a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -42,7 +42,7 @@ Assets::addScript('comment-edit.js');
|
||||||
<span class="edit">
|
<span class="edit">
|
||||||
<a href="<?= \Chibi\Router::linkTo(
|
<a href="<?= \Chibi\Router::linkTo(
|
||||||
['CommentController', 'editView'],
|
['CommentController', 'editView'],
|
||||||
['id' => $this->context->comment->id]) ?>">
|
['id' => $this->context->comment->getId()]) ?>">
|
||||||
edit
|
edit
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -56,7 +56,7 @@ Assets::addScript('comment-edit.js');
|
||||||
data-confirm-text="Are you sure you want to delete this comment?"
|
data-confirm-text="Are you sure you want to delete this comment?"
|
||||||
href="<?= \Chibi\Router::linkTo(
|
href="<?= \Chibi\Router::linkTo(
|
||||||
['CommentController', 'deleteAction'],
|
['CommentController', 'deleteAction'],
|
||||||
['id' => $this->context->comment->id]) ?>">
|
['id' => $this->context->comment->getId()]) ?>">
|
||||||
delete
|
delete
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<form method="post"
|
<form method="post"
|
||||||
action="<?= \Chibi\Router::linkTo(
|
action="<?= \Chibi\Router::linkTo(
|
||||||
['PostController', 'editAction'],
|
['PostController', 'editAction'],
|
||||||
['id' => $this->context->transport->post->id]) ?>"
|
['id' => $this->context->transport->post->getId()]) ?>"
|
||||||
enctype="multipart/form-data"
|
enctype="multipart/form-data"
|
||||||
class="edit-post">
|
class="edit-post">
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
id="relations"
|
id="relations"
|
||||||
placeholder="id1,id2,…"
|
placeholder="id1,id2,…"
|
||||||
value="<?= join(',', array_map(function($post) {
|
value="<?= join(',', array_map(function($post) {
|
||||||
return $post->id;
|
return $post->getId();
|
||||||
}, $this->context->transport->post->getRelations())) ?>"/>
|
}, $this->context->transport->post->getRelations())) ?>"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -29,7 +29,7 @@ if ($masstag)
|
||||||
<?php if ($masstag): ?>
|
<?php if ($masstag): ?>
|
||||||
<a class="toggle-tag"
|
<a class="toggle-tag"
|
||||||
href="<?= \Chibi\Router::linkTo(['PostController', 'toggleTagAction'], [
|
href="<?= \Chibi\Router::linkTo(['PostController', 'toggleTagAction'], [
|
||||||
'id' => $this->context->post->id,
|
'id' => $this->context->post->getId(),
|
||||||
'tag' => $this->context->additionalInfo,
|
'tag' => $this->context->additionalInfo,
|
||||||
'enable' => '_enable_']) ?>"
|
'enable' => '_enable_']) ?>"
|
||||||
data-text-tagged="Tagged"
|
data-text-tagged="Tagged"
|
||||||
|
@ -44,12 +44,12 @@ if ($masstag)
|
||||||
<?php if (Auth::getCurrentUser()->hasEnabledPostTagTitles()): ?>
|
<?php if (Auth::getCurrentUser()->hasEnabledPostTagTitles()): ?>
|
||||||
title="<?= TextHelper::reprTags($this->context->post->getTags()) ?>"
|
title="<?= TextHelper::reprTags($this->context->post->getTags()) ?>"
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
href="<?= \Chibi\Router::linkTo(['PostController', 'genericView'], ['id' => $this->context->post->id]) ?>">
|
href="<?= \Chibi\Router::linkTo(['PostController', 'genericView'], ['id' => $this->context->post->getId()]) ?>">
|
||||||
|
|
||||||
<img
|
<img
|
||||||
class="thumb"
|
class="thumb"
|
||||||
src="<?= \Chibi\Router::linkTo(['PostController', 'thumbView'], ['name' => $this->context->post->getName()]) ?>"
|
src="<?= \Chibi\Router::linkTo(['PostController', 'thumbView'], ['name' => $this->context->post->getName()]) ?>"
|
||||||
alt="@<?= $this->context->post->id ?>"/>
|
alt="@<?= $this->context->post->getId() ?>"/>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$x =
|
$x =
|
||||||
|
|
|
@ -155,7 +155,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
{
|
{
|
||||||
return \Chibi\Router::linkTo(
|
return \Chibi\Router::linkTo(
|
||||||
['PostController', 'scoreAction'],
|
['PostController', 'scoreAction'],
|
||||||
['id' => $this->context->transport->post->id, 'score' => $score]);
|
['id' => $this->context->transport->post->getId(), 'score' => $score]);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if (Access::check(new Privilege(
|
<?php if (Access::check(new Privilege(
|
||||||
|
@ -210,7 +210,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
<a class="add-fav icon simple-action"
|
<a class="add-fav icon simple-action"
|
||||||
href="<?= \Chibi\Router::linkTo(
|
href="<?= \Chibi\Router::linkTo(
|
||||||
['PostController', 'addFavoriteAction'],
|
['PostController', 'addFavoriteAction'],
|
||||||
['id' => $this->context->transport->post->id]) ?>">
|
['id' => $this->context->transport->post->getId()]) ?>">
|
||||||
<i class="icon-fav"></i>
|
<i class="icon-fav"></i>
|
||||||
<span>Add to favorites</span>
|
<span>Add to favorites</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -218,7 +218,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
<a class="rem-fav icon simple-action"
|
<a class="rem-fav icon simple-action"
|
||||||
href="<?= \Chibi\Router::linkTo(
|
href="<?= \Chibi\Router::linkTo(
|
||||||
['PostController', 'removeFavoriteAction'],
|
['PostController', 'removeFavoriteAction'],
|
||||||
['id' => $this->context->transport->post->id]) ?>">
|
['id' => $this->context->transport->post->getId()]) ?>">
|
||||||
<i class="icon-fav"></i>
|
<i class="icon-fav"></i>
|
||||||
<span>Remove from favorites</span>
|
<span>Remove from favorites</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -259,8 +259,10 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($this->context->transport->post->getRelations() as $relatedPost): ?>
|
<?php foreach ($this->context->transport->post->getRelations() as $relatedPost): ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= \Chibi\Router::linkTo(['PostController', 'genericView'], ['id' => $relatedPost->id]) ?>">
|
<a href="<?= \Chibi\Router::linkTo(
|
||||||
@<?= $relatedPost->id ?>
|
['PostController', 'genericView'],
|
||||||
|
['id' => $relatedPost->getId()]) ?>">
|
||||||
|
@<?= $relatedPost->getId() ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
@ -281,7 +283,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
'text' => 'Feature on main page',
|
'text' => 'Feature on main page',
|
||||||
'simple-action' => \Chibi\Router::linkTo(
|
'simple-action' => \Chibi\Router::linkTo(
|
||||||
['PostController', 'featureAction'],
|
['PostController', 'featureAction'],
|
||||||
['id' => $this->context->transport->post->id]),
|
['id' => $this->context->transport->post->getId()]),
|
||||||
'data-confirm-text' => 'Are you sure you want to feature this post on the main page?',
|
'data-confirm-text' => 'Are you sure you want to feature this post on the main page?',
|
||||||
'data-redirect-url' => \Chibi\Router::linkTo(['StaticPagesController', 'mainPageView']),
|
'data-redirect-url' => \Chibi\Router::linkTo(['StaticPagesController', 'mainPageView']),
|
||||||
];
|
];
|
||||||
|
@ -308,7 +310,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
'text' => 'Flag for moderator attention',
|
'text' => 'Flag for moderator attention',
|
||||||
'simple-action' => \Chibi\Router::linkTo(
|
'simple-action' => \Chibi\Router::linkTo(
|
||||||
['PostController', 'flagAction'],
|
['PostController', 'flagAction'],
|
||||||
['id' => $this->context->transport->post->id]),
|
['id' => $this->context->transport->post->getId()]),
|
||||||
'data-confirm-text' => 'Are you sure you want to flag this post?',
|
'data-confirm-text' => 'Are you sure you want to flag this post?',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -326,7 +328,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
'text' => 'Unhide',
|
'text' => 'Unhide',
|
||||||
'simple-action' => \Chibi\Router::linkTo(
|
'simple-action' => \Chibi\Router::linkTo(
|
||||||
['PostController', 'unhideAction'],
|
['PostController', 'unhideAction'],
|
||||||
['id' => $this->context->transport->post->id]),
|
['id' => $this->context->transport->post->getId()]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -337,7 +339,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
'text' => 'Hide',
|
'text' => 'Hide',
|
||||||
'simple-action' => \Chibi\Router::linkTo(
|
'simple-action' => \Chibi\Router::linkTo(
|
||||||
['PostController', 'hideAction'],
|
['PostController', 'hideAction'],
|
||||||
['id' => $this->context->transport->post->id]),
|
['id' => $this->context->transport->post->getId()]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -352,7 +354,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
'text' => 'Delete',
|
'text' => 'Delete',
|
||||||
'simple-action' => \Chibi\Router::linkTo(
|
'simple-action' => \Chibi\Router::linkTo(
|
||||||
['PostController', 'deleteAction'],
|
['PostController', 'deleteAction'],
|
||||||
['id' => $this->context->transport->post->id]),
|
['id' => $this->context->transport->post->getId()]),
|
||||||
'data-confirm-text' => 'Are you sure you want to delete this post?',
|
'data-confirm-text' => 'Are you sure you want to delete this post?',
|
||||||
'data-redirect-url' => \Chibi\Router::linkTo(['PostController', 'listView']),
|
'data-redirect-url' => \Chibi\Router::linkTo(['PostController', 'listView']),
|
||||||
];
|
];
|
||||||
|
|
|
@ -15,7 +15,7 @@ Assets::addStylesheet('static-main.css');
|
||||||
<?php
|
<?php
|
||||||
$this->context->transport->post = $this->context->featuredPost;
|
$this->context->transport->post = $this->context->featuredPost;
|
||||||
$this->context->imageLink = \Chibi\Router::linkTo(['PostController', 'genericView'], [
|
$this->context->imageLink = \Chibi\Router::linkTo(['PostController', 'genericView'], [
|
||||||
'id' => $this->context->featuredPost->id]);
|
'id' => $this->context->featuredPost->getId()]);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php \Chibi\View::render('post-file-render', $this->context) ?>
|
<?php \Chibi\View::render('post-file-render', $this->context) ?>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
data-confirm-text="Are you sure you want to delete your account?">
|
data-confirm-text="Are you sure you want to delete your account?">
|
||||||
|
|
||||||
<?php if (Auth::getCurrentUser()->id == $this->context->transport->user->id): ?>
|
<?php if (Auth::getCurrentUser()->getId() == $this->context->transport->user->getId()): ?>
|
||||||
<div class="form-row current-password">
|
<div class="form-row current-password">
|
||||||
<label for="current-password">Current password:</label>
|
<label for="current-password">Current password:</label>
|
||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
class="edit"
|
class="edit"
|
||||||
autocomplete="off">
|
autocomplete="off">
|
||||||
|
|
||||||
<?php if (Auth::getCurrentUser()->id == $this->context->transport->user->id): ?>
|
<?php if (Auth::getCurrentUser()->getId() == $this->context->transport->user->getId()): ?>
|
||||||
<div class="form-row current-password">
|
<div class="form-row current-password">
|
||||||
<label for="current-password">Current password:</label>
|
<label for="current-password">Current password:</label>
|
||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
|
|
|
@ -15,12 +15,12 @@ class CommentAddTest extends AbstractTest
|
||||||
|
|
||||||
$this->assert->areEqual(1, CommentModel::getCount());
|
$this->assert->areEqual(1, CommentModel::getCount());
|
||||||
$this->assert->areEqual($text, $comment->text);
|
$this->assert->areEqual($text, $comment->text);
|
||||||
$this->assert->areEqual(Auth::getCurrentUser()->id, $comment->getCommenter()->id);
|
$this->assert->areEqual(Auth::getCurrentUser()->getId(), $comment->getCommenter()->getId());
|
||||||
$this->assert->areEqual(1, $comment->getPost()->id);
|
$this->assert->areEqual(1, $comment->getPost()->getId());
|
||||||
$this->assert->isNotNull($comment->commentDate);
|
$this->assert->isNotNull($comment->commentDate);
|
||||||
$this->assert->doesNotThrow(function() use ($comment)
|
$this->assert->doesNotThrow(function() use ($comment)
|
||||||
{
|
{
|
||||||
UserModel::findById($comment->id);
|
UserModel::findById($comment->getId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class CommentAddTest extends AbstractTest
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->assert->areEqual($text, $comment->text);
|
$this->assert->areEqual($text, $comment->text);
|
||||||
$this->assert->areEqual(Auth::getCurrentUser()->id, $comment->getCommenter()->id);
|
$this->assert->areEqual(Auth::getCurrentUser()->getId(), $comment->getCommenter()->getId());
|
||||||
$this->assert->areEqual(UserModel::getAnonymousName(), $comment->getCommenter()->getName());
|
$this->assert->areEqual(UserModel::getAnonymousName(), $comment->getCommenter()->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class CommentAddTest extends AbstractTest
|
||||||
return Api::run(
|
return Api::run(
|
||||||
new AddCommentJob(),
|
new AddCommentJob(),
|
||||||
[
|
[
|
||||||
AddCommentJob::POST_ID => $post->id,
|
AddCommentJob::POST_ID => $post->getId(),
|
||||||
AddCommentJob::TEXT => $text,
|
AddCommentJob::TEXT => $text,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ class CommentDeleteTest extends AbstractTest
|
||||||
Api::run(
|
Api::run(
|
||||||
new DeleteCommentJob(),
|
new DeleteCommentJob(),
|
||||||
[
|
[
|
||||||
DeleteCommentJob::COMMENT_ID => $comment->id,
|
DeleteCommentJob::COMMENT_ID => $comment->getId(),
|
||||||
]);
|
]);
|
||||||
}, 'Insufficient privileges');
|
}, 'Insufficient privileges');
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class CommentDeleteTest extends AbstractTest
|
||||||
return Api::run(
|
return Api::run(
|
||||||
new DeleteCommentJob(),
|
new DeleteCommentJob(),
|
||||||
[
|
[
|
||||||
DeleteCommentJob::COMMENT_ID => $comment->id,
|
DeleteCommentJob::COMMENT_ID => $comment->getId(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,12 @@ class CommentEditTest extends AbstractTest
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->assert->areEqual($text, $comment->text);
|
$this->assert->areEqual($text, $comment->text);
|
||||||
$this->assert->areEqual(Auth::getCurrentUser()->id, $comment->getCommenter()->id);
|
$this->assert->areEqual(Auth::getCurrentUser()->getId(), $comment->getCommenter()->getId());
|
||||||
$this->assert->areEqual(1, $comment->getPost()->id);
|
$this->assert->areEqual(1, $comment->getPost()->getId());
|
||||||
$this->assert->isNotNull($comment->commentDate);
|
$this->assert->isNotNull($comment->commentDate);
|
||||||
$this->assert->doesNotThrow(function() use ($comment)
|
$this->assert->doesNotThrow(function() use ($comment)
|
||||||
{
|
{
|
||||||
UserModel::findById($comment->id);
|
UserModel::findById($comment->getId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class CommentEditTest extends AbstractTest
|
||||||
Api::run(
|
Api::run(
|
||||||
new EditCommentJob(),
|
new EditCommentJob(),
|
||||||
[
|
[
|
||||||
EditCommentJob::COMMENT_ID => $comment->id,
|
EditCommentJob::COMMENT_ID => $comment->getId(),
|
||||||
EditCommentJob::TEXT => 'alohaa',
|
EditCommentJob::TEXT => 'alohaa',
|
||||||
]);
|
]);
|
||||||
}, 'Insufficient privileges');
|
}, 'Insufficient privileges');
|
||||||
|
@ -145,7 +145,7 @@ class CommentEditTest extends AbstractTest
|
||||||
return Api::run(
|
return Api::run(
|
||||||
new EditCommentJob(),
|
new EditCommentJob(),
|
||||||
[
|
[
|
||||||
EditCommentJob::COMMENT_ID => $comment->id,
|
EditCommentJob::COMMENT_ID => $comment->getId(),
|
||||||
EditCommentJob::TEXT => $text,
|
EditCommentJob::TEXT => $text,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class CommentListTest extends AbstractTest
|
||||||
$post = $ret->entities[0];
|
$post = $ret->entities[0];
|
||||||
$samePost = $this->assert->doesNotThrow(function() use ($post)
|
$samePost = $this->assert->doesNotThrow(function() use ($post)
|
||||||
{
|
{
|
||||||
return PostModel::findById($post->id);
|
return PostModel::findById($post->getId());
|
||||||
});
|
});
|
||||||
//posts retrieved via ListCommentsJob should already have cached its comments
|
//posts retrieved via ListCommentsJob should already have cached its comments
|
||||||
$this->assert->areNotEquivalent($post, $samePost);
|
$this->assert->areNotEquivalent($post, $samePost);
|
||||||
|
|
Loading…
Reference in a new issue