* @since 1.0.0 */ protected static array $columns = [ 'comments_comment_vote_id' => ['name' => 'comments_comment_vote_id', 'type' => 'int', 'internal' => 'id'], 'comments_comment_vote_score' => ['name' => 'comments_comment_vote_score', 'type' => 'int', 'internal' => 'score'], 'comments_comment_vote_comment' => ['name' => 'comments_comment_vote_comment', 'type' => 'int', 'internal' => 'comment', 'readonly' => true], 'comments_comment_vote_created_by' => ['name' => 'comments_comment_vote_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'comments_comment_vote_created_at' => ['name' => 'comments_comment_vote_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], ]; /** * Primary table. * * @var string * @since 1.0.0 */ protected static string $table = 'comments_comment_vote'; /** * Created at. * * @var string * @since 1.0.0 */ protected static string $createdAt = 'comments_comment_vote_created_at'; /** * Primary field name. * * @var string * @since 1.0.0 */ protected static string $primaryField = 'comments_comment_vote_id'; /** * Find vote for comment from user * * @param int $comment Comment id * @param int $account Account id * * @return CommentVote * * @since 1.0.0 */ public static function findVote(int $comment, int $account) : CommentVote { $depth = 3; $query = self::getQuery(); $query->where(self::$table . '_d' . $depth . '.comments_comment_vote_created_by', '=', $account) ->andWhere(self::$table . '_d' . $depth . '.comments_comment_vote_comment', '=', $comment); $results = self::getAllByQuery($query); return \reset($results); } }