mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-11 18:02:59 +01:00
Disallow attachments without attachment types.
This should partly fixes issue #131. TODO: Change database structure so attachment_type is not nullable.
This commit is contained in:
@@ -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\Validator\Constraints as Assert;
|
||||
use function in_array;
|
||||
use InvalidArgumentException;
|
||||
use LogicException;
|
||||
@@ -105,6 +106,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type")
|
||||
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
* @Assert\NotNull(message="validator.attachment.must_not_be_null")
|
||||
*/
|
||||
protected $attachment_type;
|
||||
|
||||
|
||||
@@ -215,5 +215,11 @@
|
||||
<target>This location can only contain a single part and it is already full!</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="4gPskOG" name="validator.attachment.must_not_be_null">
|
||||
<segment>
|
||||
<source>validator.attachment.must_not_be_null</source>
|
||||
<target>You must select an attachment type!</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
||||
Reference in New Issue
Block a user