Fix formatting

This commit is contained in:
d-buchmann 2025-05-22 15:00:22 +02:00
parent 334a37a9d0
commit 26ee564481
2 changed files with 16 additions and 16 deletions

View file

@ -53,17 +53,17 @@ class SelectAPIController extends AbstractController
#[Route(path: '/tag', name: 'select_tag')]
public function tag(): Response
{
$tags = [
$tags = [
'text' => 'test',
'value' => 'test',
];
$this->addEmptyNode($tags);
// pseudocode:
// for each part in selection
// use TagFilter to find tags
// dedupe
return $this->json($tags);
$this->addEmptyNode($tags);
// pseudocode:
// for each part in selection
// use TagFilter to find tags
// dedupe
return $this->json($tags);
#[Route(path: '/category', name: 'select_category')]
public function category(): Response
{

View file

@ -137,18 +137,18 @@ implode(',', array_map(static fn (PartLot $lot) => $lot->getID(), $part->getPart
$this->denyAccessUnlessGranted('edit', $part);
switch ($action) {
case "add_tag":
case "add_tag":
$this->denyAccessUnlessGranted('edit', $part);
$tags = $part->getTags();
$tags = $part->getTags();
$part->setTags($tags . ',' . $target_id); // simple append
break;
case "remove_tag":
break;
case "remove_tag":
$this->denyAccessUnlessGranted('edit', $part);
$tags = $part->getTags();
$tags = str_replace($target_id, '', $tags);
// sanitize $tags (remove leading, trailing and double commas)
$tags = $part->getTags();
$tags = str_replace($target_id, '', $tags);
// sanitize $tags (remove leading, trailing and double commas)
$part->setTags($tags);
break;
break;
case 'favorite':
$this->denyAccessUnlessGranted('change_favorite', $part);
$part->setFavorite(true);