mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Migrate to SensioLabs attributes
This commit is contained in:
parent
a766826a69
commit
4e177e1778
30 changed files with 122 additions and 192 deletions
|
@ -34,10 +34,10 @@ class TagController extends AbstractController
|
|||
}
|
||||
|
||||
/**
|
||||
* @IsGranted("TAG", subject="entry")
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/new-tag/{entry}', name: 'new_tag', methods: ['POST'], requirements: ['entry' => '\d+'])]
|
||||
#[IsGranted('TAG', subject: 'entry')]
|
||||
public function addTagFormAction(Request $request, Entry $entry, TranslatorInterface $translator)
|
||||
{
|
||||
$form = $this->createForm(NewTagType::class, new Tag());
|
||||
|
@ -83,10 +83,10 @@ class TagController extends AbstractController
|
|||
/**
|
||||
* Removes tag from entry.
|
||||
*
|
||||
* @IsGranted("UNTAG", subject="entry")
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/remove-tag/{entry}/{tag}', name: 'remove_tag', methods: ['GET'], requirements: ['entry' => '\d+', 'tag' => '\d+'])]
|
||||
#[IsGranted('UNTAG', subject: 'entry')]
|
||||
public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag)
|
||||
{
|
||||
$entry->removeTag($tag);
|
||||
|
@ -106,10 +106,10 @@ class TagController extends AbstractController
|
|||
/**
|
||||
* Shows tags for current user.
|
||||
*
|
||||
* @IsGranted("LIST_TAGS")
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/tag/list', name: 'tag', methods: ['GET'])]
|
||||
#[IsGranted('LIST_TAGS')]
|
||||
public function showTagAction(TagRepository $tagRepository, EntryRepository $entryRepository)
|
||||
{
|
||||
$allTagsWithNbEntries = $tagRepository->findAllTagsWithNbEntries($this->getUser()->getId());
|
||||
|
@ -130,12 +130,12 @@ class TagController extends AbstractController
|
|||
/**
|
||||
* @param int $page
|
||||
*
|
||||
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
||||
* @IsGranted("LIST_ENTRIES")
|
||||
* @IsGranted("VIEW", subject="tag")
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/tag/list/{slug}/{page}', name: 'tag_entries', methods: ['GET'], defaults: ['page' => '1'])]
|
||||
#[ParamConverter('tag', options: ['mapping' => ['slug' => 'slug']])]
|
||||
#[IsGranted('LIST_ENTRIES')]
|
||||
#[IsGranted('VIEW', subject: 'tag')]
|
||||
public function showEntriesForTagAction(Tag $tag, EntryRepository $entryRepository, PreparePagerForEntries $preparePagerForEntries, $page, Request $request)
|
||||
{
|
||||
$entriesByTag = $entryRepository->findAllByTagId(
|
||||
|
@ -170,11 +170,11 @@ class TagController extends AbstractController
|
|||
* Rename a given tag with a new label
|
||||
* Create a new tag with the new name and drop the old one.
|
||||
*
|
||||
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
||||
* @IsGranted("EDIT", subject="tag")
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/tag/rename/{slug}', name: 'tag_rename', methods: ['POST'])]
|
||||
#[ParamConverter('tag', options: ['mapping' => ['slug' => 'slug']])]
|
||||
#[IsGranted('EDIT', subject: 'tag')]
|
||||
public function renameTagAction(Tag $tag, Request $request, TagRepository $tagRepository, EntryRepository $entryRepository)
|
||||
{
|
||||
$form = $this->createForm(RenameTagType::class, new Tag());
|
||||
|
@ -223,10 +223,10 @@ class TagController extends AbstractController
|
|||
/**
|
||||
* Tag search results with the current search term.
|
||||
*
|
||||
* @IsGranted("CREATE_TAGS")
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/tag/search/{filter}', name: 'tag_this_search', methods: ['GET'])]
|
||||
#[IsGranted('CREATE_TAGS')]
|
||||
public function tagThisSearchAction($filter, Request $request, EntryRepository $entryRepository)
|
||||
{
|
||||
$currentRoute = $request->query->has('currentRoute') ? $request->query->get('currentRoute') : '';
|
||||
|
@ -258,11 +258,11 @@ class TagController extends AbstractController
|
|||
/**
|
||||
* Delete a given tag for the current user.
|
||||
*
|
||||
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
||||
* @IsGranted("DELETE", subject="tag")
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/tag/delete/{slug}', name: 'tag_delete', methods: ['GET'])]
|
||||
#[ParamConverter('tag', options: ['mapping' => ['slug' => 'slug']])]
|
||||
#[IsGranted('DELETE', subject: 'tag')]
|
||||
public function removeTagAction(Tag $tag, Request $request, EntryRepository $entryRepository)
|
||||
{
|
||||
foreach ($tag->getEntriesByUserId($this->getUser()->getId()) as $entry) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue