mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-12 11:24:31 +02:00
Fixed some inspection issues
This commit is contained in:
parent
c6f1758a18
commit
8ae4e9fe05
39 changed files with 46 additions and 56 deletions
|
@ -166,16 +166,11 @@ class EntityURLGenerator
|
|||
|
||||
public function viewURL(Attachment $entity): ?string
|
||||
{
|
||||
if ($entity instanceof Attachment) {
|
||||
if ($entity->isExternal()) { //For external attachments, return the link to external path
|
||||
return $entity->getURL();
|
||||
}
|
||||
//return $this->urlGenerator->generate('attachment_view', ['id' => $entity->getID()]);
|
||||
return $this->attachmentURLGenerator->getViewURL($entity);
|
||||
if ($entity->isExternal()) { //For external attachments, return the link to external path
|
||||
return $entity->getURL();
|
||||
}
|
||||
|
||||
//Otherwise throw an error
|
||||
throw new EntityNotSupportedException('The given entity is not supported yet!');
|
||||
//return $this->urlGenerator->generate('attachment_view', ['id' => $entity->getID()]);
|
||||
return $this->attachmentURLGenerator->getViewURL($entity);
|
||||
}
|
||||
|
||||
public function downloadURL($entity): ?string
|
||||
|
|
|
@ -26,7 +26,7 @@ use App\Entity\Parts\Part;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use function \mb_strlen;
|
||||
use function mb_strlen;
|
||||
use function array_slice;
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,7 +55,7 @@ class UserCacheKeyGenerator
|
|||
|
||||
//If the user is null, then treat it as anonymous user.
|
||||
//When the anonymous user is passed as user then use this path too.
|
||||
if (null === $user || !($user instanceof User) || User::ID_ANONYMOUS === $user->getID()) {
|
||||
if (!($user instanceof User) || User::ID_ANONYMOUS === $user->getID()) {
|
||||
return 'user$_'.User::ID_ANONYMOUS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue