mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 05:24:28 +02:00
Use the name of an uploaded file for an attachment when no explicit name was set.
This commit is contained in:
parent
4a30819ea5
commit
52e459ec60
3 changed files with 40 additions and 6 deletions
|
@ -25,6 +25,7 @@ namespace App\Entity\Attachments;
|
|||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use function in_array;
|
||||
use InvalidArgumentException;
|
||||
|
@ -95,6 +96,14 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
*/
|
||||
protected string $path = '';
|
||||
|
||||
/**
|
||||
* @var string the name of this element
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\NotBlank(message="validator.attachment.name_not_blank")
|
||||
* @Groups({"simple", "extended", "full"})
|
||||
*/
|
||||
protected string $name = '';
|
||||
|
||||
/**
|
||||
* ORM mapping is done in sub classes (like PartAttachment).
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue