mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Use proper way of overriding doctrine attributes
In older versions doctrine allowed overriding attributes, by simply redifining them in subclasses. In 2.16 this throws an exception. We now use the proper way using the AttributeOverrides attribute
This commit is contained in:
parent
1a3e5ec705
commit
c981476706
3 changed files with 5 additions and 8 deletions
|
@ -97,7 +97,6 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
*/
|
*/
|
||||||
#[Assert\NotBlank(message: 'validator.attachment.name_not_blank')]
|
#[Assert\NotBlank(message: 'validator.attachment.name_not_blank')]
|
||||||
#[Groups(['simple', 'extended', 'full'])]
|
#[Groups(['simple', 'extended', 'full'])]
|
||||||
#[ORM\Column(type: Types::STRING)]
|
|
||||||
protected string $name = '';
|
protected string $name = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -84,10 +84,10 @@ class Part extends AttachmentContainingDBElement
|
||||||
* Overridden properties
|
* Overridden properties
|
||||||
* (They are defined here and not in a trait, to avoid conflicts).
|
* (They are defined here and not in a trait, to avoid conflicts).
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string The name of this part
|
* @var string The name of this part
|
||||||
*/
|
*/
|
||||||
#[ORM\Column(type: Types::STRING)]
|
|
||||||
protected string $name = '';
|
protected string $name = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -69,6 +69,10 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
|
||||||
#[ORM\EntityListeners([TreeCacheInvalidationListener::class])]
|
#[ORM\EntityListeners([TreeCacheInvalidationListener::class])]
|
||||||
#[ORM\Table('`users`')]
|
#[ORM\Table('`users`')]
|
||||||
#[ORM\Index(name: 'user_idx_username', columns: ['name'])]
|
#[ORM\Index(name: 'user_idx_username', columns: ['name'])]
|
||||||
|
#[ORM\AttributeOverrides([
|
||||||
|
new ORM\AttributeOverride(name: 'name', column: new ORM\Column(type: Types::STRING, length: 180, unique: true))
|
||||||
|
])]
|
||||||
|
|
||||||
#[NoLockout()]
|
#[NoLockout()]
|
||||||
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface,
|
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface,
|
||||||
BackupCodeInterface, TrustedDeviceInterface, WebauthnTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface, SamlUserInterface
|
BackupCodeInterface, TrustedDeviceInterface, WebauthnTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface, SamlUserInterface
|
||||||
|
@ -125,11 +129,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
#[ORM\Column(type: Types::JSON)]
|
#[ORM\Column(type: Types::JSON)]
|
||||||
protected ?array $backupCodes = [];
|
protected ?array $backupCodes = [];
|
||||||
|
|
||||||
#[ORM\Id]
|
|
||||||
#[ORM\GeneratedValue]
|
|
||||||
#[ORM\Column(type: Types::INTEGER)]
|
|
||||||
protected ?int $id = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Group|null the group this user belongs to
|
* @var Group|null the group this user belongs to
|
||||||
* DO NOT PUT A fetch eager here! Otherwise, you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions.
|
* DO NOT PUT A fetch eager here! Otherwise, you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions.
|
||||||
|
@ -212,7 +211,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
#[Assert\NotBlank]
|
#[Assert\NotBlank]
|
||||||
#[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')]
|
#[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')]
|
||||||
#[ORM\Column(type: Types::STRING, length: 180, unique: true)]
|
|
||||||
protected string $name = '';
|
protected string $name = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue