Compare commits

..

No commits in common. "ab3a54bde92ed576fd306e1ece0e92802a375335" and "0a8c6b0395d7f56b068f48819da968a2095b3d9a" have entirely different histories.

15 changed files with 49 additions and 53 deletions

View file

@ -19,7 +19,7 @@ doctrine:
dql: dql:
string_functions: string_functions:
# TODO fix to receive correct DateTime instead of string # TODO fix to receive correct DateTime instead of string
DAY: App\Doctrine\DQL\Day DAY: App\DQL\Day
when@test: when@test:
doctrine: doctrine:

View file

@ -1,4 +1,4 @@
# https://github.com/KnpLabs/KnpPaginatorBundle#yaml # https://github.com/KnpLabs/KnpPaginatorBundle#yaml
knp_paginator: knp_paginator:
template: template:
pagination: '@KnpPaginator/Pagination/bootstrap_v5_pagination.html.twig' pagination: 'KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig'

View file

@ -6,7 +6,7 @@
index: index:
path: / path: /
defaults: { _controller: App\Controller\MainController::index } defaults: { _controller: App\Controller\MainController::indexAction }
methods: [POST, GET] methods: [POST, GET]
user_search_ajax: user_search_ajax:

View file

@ -1,4 +1,4 @@
{% extends 'Web/base.html.twig' %} {% extends "::base.html.twig" %}
{% block header_title %}{{ user.login }} @ Point Tools{% endblock %} {% block header_title %}{{ user.login }} @ Point Tools{% endblock %}

View file

@ -1,4 +1,4 @@
{% extends 'Web/base.html.twig' %} {% extends "::base.html.twig" %}
{% block header_title %}Stats @ Point Tools{% endblock %} {% block header_title %}Stats @ Point Tools{% endblock %}

View file

@ -15,7 +15,7 @@ class ApiController
* *
* @ParamConverter("user", class="SkobkinPointToolsBundle:User") * @ParamConverter("user", class="SkobkinPointToolsBundle:User")
*/ */
public function lastUserSubscribersById(User $user, SubscriptionEventRepository $subscriptionEventRepository): Response public function lastUserSubscribersByIdAction(User $user, SubscriptionEventRepository $subscriptionEventRepository): Response
{ {
$qb = $subscriptionEventRepository->createQueryBuilder('se'); $qb = $subscriptionEventRepository->createQueryBuilder('se');
$qb $qb

View file

@ -10,7 +10,7 @@ use Symfony\Component\HttpFoundation\{Request, Response};
class EventsController extends AbstractController class EventsController extends AbstractController
{ {
public function last(Request $request, SubscriptionEventRepository $eventRepository, PaginatorInterface $paginator): Response public function lastAction(Request $request, SubscriptionEventRepository $eventRepository, PaginatorInterface $paginator): Response
{ {
$eventsPagination = $paginator->paginate( $eventsPagination = $paginator->paginate(
$eventRepository->createLastSubscriptionEventsQuery(), $eventRepository->createLastSubscriptionEventsQuery(),

View file

@ -19,7 +19,7 @@ class MainController extends AbstractController
) { ) {
} }
public function index( public function indexAction(
Request $request, Request $request,
UserRepository $userRepository, UserRepository $userRepository,
SubscriptionRepository $subscriptionRepository, SubscriptionRepository $subscriptionRepository,
@ -56,7 +56,7 @@ class MainController extends AbstractController
} }
/** Returns user search autocomplete data in JSON */ /** Returns user search autocomplete data in JSON */
public function searchUserAjax(string $login, UserRepository $userRepository): JsonResponse public function searchUserAjaxAction(string $login, UserRepository $userRepository): JsonResponse
{ {
$result = []; $result = [];

View file

@ -14,7 +14,7 @@ class PostController extends AbstractController
/** /**
* @ParamConverter("post", class="SkobkinPointToolsBundle:Blogs\Post") * @ParamConverter("post", class="SkobkinPointToolsBundle:Blogs\Post")
*/ */
public function show(Post $post, PostRepository $postRepository): Response public function showAction(Post $post, PostRepository $postRepository): Response
{ {
if ((!$post->getAuthor()->isPublic()) || $post->getAuthor()->isWhitelistOnly()) { if ((!$post->getAuthor()->isPublic()) || $post->getAuthor()->isWhitelistOnly()) {
/** /**

View file

@ -12,7 +12,7 @@ class PublicFeedController extends AbstractController
{ {
private const POSTS_PER_PAGE = 20; private const POSTS_PER_PAGE = 20;
public function index(Request $request, PostRepository $postRepository, PaginatorInterface $paginator): Response public function indexAction(Request $request, PostRepository $postRepository, PaginatorInterface $paginator): Response
{ {
$postsPagination = $paginator->paginate( $postsPagination = $paginator->paginate(
$postRepository->createPublicFeedPostsQuery(), $postRepository->createPublicFeedPostsQuery(),

View file

@ -19,7 +19,7 @@ class UserController extends AbstractController
) { ) {
} }
public function show( public function showAction(
Request $request, Request $request,
string $login, string $login,
SubscriptionEventRepository $subscriptionEventRepository, SubscriptionEventRepository $subscriptionEventRepository,
@ -40,7 +40,7 @@ class UserController extends AbstractController
10 10
); );
return $this->render('Web/User/show.html.twig', [ return $this->render('SkobkinPointToolsBundle:User:show.html.twig', [
'user' => $user, 'user' => $user,
'subscribers' => $userRepository->findUserSubscribersById($user->getId()), 'subscribers' => $userRepository->findUserSubscribersById($user->getId()),
'subscriptions_log' => $subscriberEventsPagination, 'subscriptions_log' => $subscriberEventsPagination,
@ -48,12 +48,12 @@ class UserController extends AbstractController
]); ]);
} }
public function top(UserRepository $userRepository, SubscriptionEventRepository $subscriptionEventRepository): Response public function topAction(UserRepository $userRepository, SubscriptionEventRepository $subscriptionEventRepository): Response
{ {
$topUsers = $userRepository->getTopUsers(); $topUsers = $userRepository->getTopUsers();
$eventsByDay = $subscriptionEventRepository->getLastEventsByDay(); $eventsByDay = $subscriptionEventRepository->getLastEventsByDay();
return $this->render('Web/User/top.html.twig', [ return $this->render('@SkobkinPointTools/User/top.html.twig', [
'events_dynamic_chat' => $this->createEventsDynamicChart($eventsByDay), 'events_dynamic_chat' => $this->createEventsDynamicChart($eventsByDay),
'top_chart' => $this->createTopUsersGraph($topUsers), 'top_chart' => $this->createTopUsersGraph($topUsers),
]); ]);

View file

@ -3,10 +3,11 @@ declare(strict_types=1);
namespace App\Entity\Blog; namespace App\Entity\Blog;
use App\Entity\Blog\File;
use App\Entity\Blog\Post;
use App\Entity\User; use App\Entity\User;
use App\Repository\Blog\CommentRepository; use App\Repository\Blog\CommentRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CommentRepository::class)] #[ORM\Entity(repositoryClass: CommentRepository::class)]
@ -42,20 +43,20 @@ class Comment
#[ORM\JoinColumn(name: 'author_id')] #[ORM\JoinColumn(name: 'author_id')]
private User $author; private User $author;
/** @var Collection<int, File> */ /** @var ArrayCollection|File[] */
#[ORM\ManyToMany(targetEntity: File::class, fetch: 'EXTRA_LAZY')] #[ORM\ManyToMany(targetEntity: File::class, fetch: 'EXTRA_LAZY')]
#[ORM\JoinTable(name: 'comments_files', schema: 'posts')] #[ORM\JoinTable(name: 'comments_files', schema: 'posts')]
#[ORM\JoinColumn(name: 'comment_id')] #[ORM\JoinColumn(name: 'comment_id')]
#[ORM\InverseJoinColumn(name: 'file_id')] #[ORM\InverseJoinColumn(name: 'file_id')]
private Collection $files; private ArrayCollection $files;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')] #[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id', nullable: true)] #[ORM\JoinColumn(name: 'parent_id', nullable: true)]
private ?self $parent; private ?self $parent;
/** @var Collection<int, self> */ /** @var ArrayCollection|self[] */
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class, fetch: 'EXTRA_LAZY')] #[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class, fetch: 'EXTRA_LAZY')]
private Collection $children; private ArrayCollection $children;
public function __construct() public function __construct()
@ -158,8 +159,10 @@ class Comment
$this->files->removeElement($files); $this->files->removeElement($files);
} }
/** @return Collection<int, File> */ /**
public function getFiles(): Collection * @return File[]|ArrayCollection
*/
public function getFiles(): iterable
{ {
return $this->files; return $this->files;
} }
@ -205,8 +208,8 @@ class Comment
$this->children->removeElement($children); $this->children->removeElement($children);
} }
/** @return Collection<int, self> */ /** @return ArrayCollection|self[] */
public function getChildren(): Collection public function getChildren(): iterable
{ {
return $this->children; return $this->children;
} }

View file

@ -6,7 +6,6 @@ namespace App\Entity\Blog;
use App\Entity\User; use App\Entity\User;
use App\Repository\Blog\TagRepository; use App\Repository\Blog\TagRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TagRepository::class)] #[ORM\Entity(repositoryClass: TagRepository::class)]
@ -30,7 +29,6 @@ class Post
#[ORM\Column(name: 'updated_at', type: 'datetime', nullable: true)] #[ORM\Column(name: 'updated_at', type: 'datetime', nullable: true)]
private ?\DateTime $updatedAt; private ?\DateTime $updatedAt;
// TODO: Native Enum
#[ORM\Column(name: 'type', type: 'string', length: 6)] #[ORM\Column(name: 'type', type: 'string', length: 6)]
private string $type = self::TYPE_POST; private string $type = self::TYPE_POST;
@ -44,20 +42,19 @@ class Post
#[ORM\JoinColumn(name: 'author')] #[ORM\JoinColumn(name: 'author')]
private User $author; private User $author;
/** @var Collection<int, File> */ /** @var ArrayCollection|File[] */
#[ORM\ManyToMany(targetEntity: File::class, cascade: ['persist'], fetch: 'EXTRA_LAZY')] #[ORM\ManyToMany(targetEntity: File::class, cascade: ['persist'], fetch: 'EXTRA_LAZY')]
#[ORM\JoinTable(name: 'posts_files', schema: 'posts')] #[ORM\JoinTable(name: 'posts_files', schema: 'posts')]
#[ORM\JoinColumn(name: 'post_id')] #[ORM\JoinColumn(name: 'post_id')]
#[ORM\InverseJoinColumn(name: 'file_id')] #[ORM\InverseJoinColumn(name: 'file_id')]
private Collection $files; private $files;
/** @var Collection<int, PostTag> */
#[ORM\OneToMany(mappedBy: 'post', targetEntity: PostTag::class, cascade: ['persist'], fetch: 'EXTRA_LAZY', orphanRemoval: true)] #[ORM\OneToMany(mappedBy: 'post', targetEntity: PostTag::class, cascade: ['persist'], fetch: 'EXTRA_LAZY', orphanRemoval: true)]
private Collection $postTags; private ArrayCollection $postTags;
/** @var Collection<int, Comment> */ /** @var ArrayCollection|Comment[] */
#[ORM\OneToMany(mappedBy: 'post', targetEntity: Comment::class, cascade: ['persist'])] #[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'post', cascade: ['persist'], )]
private Collection $comments; private ArrayCollection $comments;
public function __construct(string $id, User $author, \DateTime $createdAt, string $type) public function __construct(string $id, User $author, \DateTime $createdAt, string $type)
@ -127,8 +124,8 @@ class Post
$this->files->removeElement($files); $this->files->removeElement($files);
} }
/** @return Collection<int, File> */ /** @return File[]|ArrayCollection */
public function getFiles(): Collection public function getFiles(): iterable
{ {
return $this->files; return $this->files;
} }
@ -145,8 +142,8 @@ class Post
$this->postTags->removeElement($tag); $this->postTags->removeElement($tag);
} }
/** @return Collection<int, PostTag> */ /** @return PostTag[]|ArrayCollection */
public function getPostTags(): Collection public function getPostTags(): iterable
{ {
return $this->postTags; return $this->postTags;
} }
@ -198,8 +195,8 @@ class Post
$this->comments->removeElement($comment); $this->comments->removeElement($comment);
} }
/** @return Collection<int, Comment> */ /** @return Comment[]|ArrayCollection */
public function getComments(): Collection public function getComments(): iterable
{ {
return $this->comments; return $this->comments;
} }

View file

@ -6,7 +6,6 @@ namespace App\Entity;
use App\Repository\UserRepository; use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: UserRepository::class)] #[ORM\Entity(repositoryClass: UserRepository::class)]
@ -42,17 +41,14 @@ class User
#[ORM\Column(name: 'whitelist_only', type: 'boolean', nullable: false, options: ['default' => false])] #[ORM\Column(name: 'whitelist_only', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $whitelistOnly = false; private bool $whitelistOnly = false;
/** @var Collection<int, Subscription> */
#[ORM\OneToMany(mappedBy: 'author', targetEntity: Subscription::class, fetch: 'EXTRA_LAZY')] #[ORM\OneToMany(mappedBy: 'author', targetEntity: Subscription::class, fetch: 'EXTRA_LAZY')]
private Collection $subscribers; private ArrayCollection $subscribers;
/** @var Collection<int, Subscription> */
#[ORM\OneToMany(mappedBy: 'subscriber', targetEntity: Subscription::class, fetch: 'EXTRA_LAZY')] #[ORM\OneToMany(mappedBy: 'subscriber', targetEntity: Subscription::class, fetch: 'EXTRA_LAZY')]
private Collection $subscriptions; private ArrayCollection $subscriptions;
/** @var Collection<int, SubscriptionEvent> */
#[ORM\OneToMany(mappedBy: 'author', targetEntity: SubscriptionEvent::class, fetch: 'EXTRA_LAZY')] #[ORM\OneToMany(mappedBy: 'author', targetEntity: SubscriptionEvent::class, fetch: 'EXTRA_LAZY')]
private Collection $newSubscriberEvents; private ArrayCollection $newSubscriberEvents;
#[ORM\Column(name: 'is_removed', type: 'boolean', options: ['default' => false])] #[ORM\Column(name: 'is_removed', type: 'boolean', options: ['default' => false])]
private bool $removed = false; private bool $removed = false;
@ -114,14 +110,14 @@ class User
$this->subscribers->removeElement($subscribers); $this->subscribers->removeElement($subscribers);
} }
/** @return Collection<int, Subscription> */ /** @return Subscription[]|ArrayCollection */
public function getSubscribers(): Collection public function getSubscribers(): ArrayCollection
{ {
return $this->subscribers; return $this->subscribers;
} }
/** @return Collection<int, Subscription> */ /** @return Subscription[]|ArrayCollection */
public function getSubscriptions(): Collection public function getSubscriptions(): ArrayCollection
{ {
return $this->subscriptions; return $this->subscriptions;
} }
@ -133,8 +129,8 @@ class User
return $this; return $this;
} }
/** @return Collection<int, SubscriptionEvent> */ /** @return SubscriptionEvent[]|ArrayCollection */
public function getNewSubscriberEvents(): Collection public function getNewSubscriberEvents(): ArrayCollection
{ {
return $this->newSubscriberEvents; return $this->newSubscriberEvents;
} }

View file

@ -1,4 +1,4 @@
{% extends 'Web/base.html.twig' %} {% extends "::base.html.twig" %}
{% block content %} {% block content %}
{# TODO classes #} {# TODO classes #}