diff --git a/src/Entity/Analytics.php b/src/Entity/Analytics.php index ea0649197..dfca7d936 100644 --- a/src/Entity/Analytics.php +++ b/src/Entity/Analytics.php @@ -31,11 +31,11 @@ class Analytics public const INTERVAL_DAILY = 'day'; public const INTERVAL_HOURLY = 'hour'; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $station_id = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Station $station = null; #[ORM\Column(length: 15)] @@ -53,7 +53,7 @@ class Analytics #[ORM\Column(type: 'decimal', precision: 10, scale: 2)] protected string $number_avg; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $number_unique = null; public function __construct( diff --git a/src/Entity/ApiKey.php b/src/Entity/ApiKey.php index e623206f0..506f0a82f 100644 --- a/src/Entity/ApiKey.php +++ b/src/Entity/ApiKey.php @@ -20,10 +20,10 @@ class ApiKey implements JsonSerializable, Stringable use Traits\TruncateStrings; #[ORM\ManyToOne(targetEntity: User::class, fetch: 'EAGER', inversedBy: 'api_keys')] - #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected User $user; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $comment = null; public function __construct(User $user, SplitToken $token) diff --git a/src/Entity/AuditLog.php b/src/Entity/AuditLog.php index 44bd29e77..e82fa56a0 100644 --- a/src/Entity/AuditLog.php +++ b/src/Entity/AuditLog.php @@ -34,16 +34,16 @@ class AuditLog #[ORM\Column(length: 255)] protected string $identifier; - #[ORM\Column(name: 'target_class', length: 255)] + #[ORM\Column(name: 'target_class', length: 255, nullable: true)] protected ?string $targetClass; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $target; #[ORM\Column(type: 'array')] protected array $changes; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $user; public function __construct( diff --git a/src/Entity/CustomField.php b/src/Entity/CustomField.php index e2f274147..10c5a0d06 100644 --- a/src/Entity/CustomField.php +++ b/src/Entity/CustomField.php @@ -25,11 +25,11 @@ class CustomField implements \Stringable protected string $name; /** @OA\Property(description="The programmatic name for the field. Can be auto-generated from the full name.") */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $short_name = null; /** @OA\Property(description="An ID3v2 field to automatically assign to this value, if it exists in the media file.") */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $auto_assign = null; public function getName(): string diff --git a/src/Entity/Listener.php b/src/Entity/Listener.php index 4c7e89eb2..66c219280 100644 --- a/src/Entity/Listener.php +++ b/src/Entity/Listener.php @@ -17,25 +17,25 @@ class Listener use Traits\HasAutoIncrementId; use Traits\TruncateStrings; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $station_id; #[ORM\ManyToOne(inversedBy: 'history')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $mount_id = null; #[ORM\ManyToOne(targetEntity: StationMount::class)] - #[ORM\JoinColumn(name: 'mount_id', referencedColumnName: 'id', onDelete: 'SET NULL')] + #[ORM\JoinColumn(name: 'mount_id', referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')] protected ?StationMount $mount = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $remote_id = null; #[ORM\ManyToOne(targetEntity: StationRemote::class)] - #[ORM\JoinColumn(name: 'remote_id', referencedColumnName: 'id', onDelete: 'SET NULL')] + #[ORM\JoinColumn(name: 'remote_id', referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')] protected ?StationRemote $remote = null; #[ORM\Column] diff --git a/src/Entity/MessengerMessage.php b/src/Entity/MessengerMessage.php index 6dcbada1a..be873d0d8 100644 --- a/src/Entity/MessengerMessage.php +++ b/src/Entity/MessengerMessage.php @@ -37,6 +37,6 @@ class MessengerMessage #[ORM\Column(name: 'available_at')] protected DateTime $availableAt; - #[ORM\Column(name: 'delivered_at')] + #[ORM\Column(name: 'delivered_at', nullable: true)] protected ?DateTime $deliveredAt = null; } diff --git a/src/Entity/Podcast.php b/src/Entity/Podcast.php index 7c2661f75..28adcc220 100644 --- a/src/Entity/Podcast.php +++ b/src/Entity/Podcast.php @@ -23,14 +23,14 @@ class Podcast public const DIR_PODCAST_ARTWORK = '.podcast_art'; #[ORM\ManyToOne(targetEntity: StorageLocation::class)] - #[ORM\JoinColumn(name: 'storage_location_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'storage_location_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StorageLocation $storage_location; #[ORM\Column(length: 255)] #[Assert\NotBlank] protected string $title; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $link = null; #[ORM\Column(type: 'text')] diff --git a/src/Entity/PodcastCategory.php b/src/Entity/PodcastCategory.php index ecce85414..b2846aae9 100644 --- a/src/Entity/PodcastCategory.php +++ b/src/Entity/PodcastCategory.php @@ -20,7 +20,7 @@ class PodcastCategory public const CATEGORY_SEPARATOR = '|'; #[ORM\ManyToOne(inversedBy: 'categories')] - #[ORM\JoinColumn(name: 'podcast_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'podcast_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Podcast $podcast; #[ORM\Column(length: 255)] diff --git a/src/Entity/PodcastEpisode.php b/src/Entity/PodcastEpisode.php index 1e2cafdcd..4ebf011a5 100644 --- a/src/Entity/PodcastEpisode.php +++ b/src/Entity/PodcastEpisode.php @@ -22,7 +22,7 @@ class PodcastEpisode public const DIR_PODCAST_EPISODE_ARTWORK = '.podcast_episode_art'; #[ORM\ManyToOne(inversedBy: 'episodes')] - #[ORM\JoinColumn(name: 'podcast_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'podcast_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Podcast $podcast; #[ORM\OneToOne(mappedBy: 'episode')] @@ -32,14 +32,14 @@ class PodcastEpisode #[Assert\NotBlank] protected string $title; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $link = null; #[ORM\Column(type: 'text')] #[Assert\NotBlank] protected string $description; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $publish_at = null; #[ORM\Column] diff --git a/src/Entity/PodcastMedia.php b/src/Entity/PodcastMedia.php index c1dc03e23..a2b12f56b 100644 --- a/src/Entity/PodcastMedia.php +++ b/src/Entity/PodcastMedia.php @@ -20,11 +20,11 @@ class PodcastMedia use Traits\TruncateStrings; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'storage_location_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'storage_location_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StorageLocation $storage_location; #[ORM\OneToOne(inversedBy: 'media')] - #[ORM\JoinColumn(name: 'episode_id', referencedColumnName: 'id', onDelete: 'SET NULL')] + #[ORM\JoinColumn(name: 'episode_id', referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')] protected ?PodcastEpisode $episode; #[ORM\Column(length: 200)] diff --git a/src/Entity/Relay.php b/src/Entity/Relay.php index 21ab84e48..4df566945 100644 --- a/src/Entity/Relay.php +++ b/src/Entity/Relay.php @@ -25,7 +25,7 @@ class Relay protected string $base_url; /** @OA\Property(example="Relay") */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $name = 'Relay'; /** @OA\Property(example=true) */ diff --git a/src/Entity/RolePermission.php b/src/Entity/RolePermission.php index 17afe6b7e..d46e99fa8 100644 --- a/src/Entity/RolePermission.php +++ b/src/Entity/RolePermission.php @@ -20,17 +20,17 @@ class RolePermission implements JsonSerializable protected int $role_id; #[ORM\ManyToOne(inversedBy: 'permissions')] - #[ORM\JoinColumn(name: 'role_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'role_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Role $role; #[ORM\Column(length: 50)] protected string $action_name; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $station_id = null; #[ORM\ManyToOne(inversedBy: 'permissions')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Station $station = null; public function __construct(Role $role, Station $station = null, $action_name = null) diff --git a/src/Entity/Settings.php b/src/Entity/Settings.php index 552ce6374..db573f782 100644 --- a/src/Entity/Settings.php +++ b/src/Entity/Settings.php @@ -37,7 +37,7 @@ class Settings implements Stringable * example="https://your.azuracast.site" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $base_url = ''; public function getBaseUrl(): ?string @@ -56,7 +56,7 @@ class Settings implements Stringable * example="My AzuraCast Instance" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $instance_name = null; public function getInstanceName(): ?string @@ -151,7 +151,7 @@ class Settings implements Stringable * example="*" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $api_access_control = ''; public function getApiAccessControl(): string @@ -188,7 +188,7 @@ class Settings implements Stringable * description="Listener Analytics Collection" * ) */ - #[ORM\Column(length: 50)] + #[ORM\Column(length: 50, nullable: true)] #[Assert\Choice([Analytics::LEVEL_NONE, Analytics::LEVEL_NO_IP, Analytics::LEVEL_ALL])] protected ?string $analytics = Analytics::LEVEL_ALL; @@ -276,7 +276,7 @@ class Settings implements Stringable * example="light" * ) */ - #[ORM\Column(length: 50)] + #[ORM\Column(length: 50, nullable: true)] #[Assert\Choice([Customization::THEME_BROWSER, Customization::THEME_LIGHT, Customization::THEME_DARK])] protected ?string $public_theme = Customization::DEFAULT_THEME; @@ -315,7 +315,7 @@ class Settings implements Stringable * example="https://example.com/" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $homepage_redirect_url = null; public function getHomepageRedirectUrl(): ?string @@ -334,7 +334,7 @@ class Settings implements Stringable * example="https://example.com/image.jpg" * ) */ - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?string $default_album_art_url = null; public function getDefaultAlbumArtUrl(): ?string @@ -391,7 +391,7 @@ class Settings implements Stringable * example="SAMPLE-API-KEY" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $last_fm_api_key = null; public function getLastFmApiKey(): ?string @@ -432,7 +432,7 @@ class Settings implements Stringable * example="" * ) */ - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $public_custom_css = null; public function getPublicCustomCss(): ?string @@ -451,7 +451,7 @@ class Settings implements Stringable * example="" * ) */ - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $public_custom_js = null; public function getPublicCustomJs(): ?string @@ -470,7 +470,7 @@ class Settings implements Stringable * example="" * ) */ - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $internal_custom_css = null; public function getInternalCustomCss(): ?string @@ -508,7 +508,7 @@ class Settings implements Stringable * example=400 * ) */ - #[ORM\Column(length: 4)] + #[ORM\Column(length: 4, nullable: true)] protected ?string $backup_time_code = null; public function getBackupTimeCode(): ?string @@ -565,7 +565,7 @@ class Settings implements Stringable * example=1 * ) */ - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $backup_storage_location = null; public function getBackupStorageLocation(): ?int @@ -609,7 +609,7 @@ class Settings implements Stringable * example="" * ) */ - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] #[Attributes\AuditIgnore] protected ?string $backup_last_result = null; @@ -629,7 +629,7 @@ class Settings implements Stringable * example="" * ) */ - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] #[Attributes\AuditIgnore] protected ?string $backup_last_output = null; @@ -679,7 +679,7 @@ class Settings implements Stringable * ) * @var mixed[]|null */ - #[ORM\Column(type: 'json')] + #[ORM\Column(type: 'json', nullable: true)] #[Attributes\AuditIgnore] protected ?array $nowplaying = null; @@ -815,7 +815,7 @@ class Settings implements Stringable * example="192.168.1.1" * ) */ - #[ORM\Column(length: 45)] + #[ORM\Column(length: 45, nullable: true)] #[Attributes\AuditIgnore] protected ?string $external_ip = null; @@ -835,7 +835,7 @@ class Settings implements Stringable * example="" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $geolite_license_key = null; public function getGeoliteLicenseKey(): ?string @@ -919,7 +919,7 @@ class Settings implements Stringable * example="AzuraCast" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $mail_sender_name = ''; public function getMailSenderName(): string @@ -938,7 +938,7 @@ class Settings implements Stringable * example="example@example.com" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $mail_sender_email = ''; public function getMailSenderEmail(): string @@ -957,7 +957,7 @@ class Settings implements Stringable * example="smtp.example.com" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $mail_smtp_host = ''; public function getMailSmtpHost(): string @@ -995,7 +995,7 @@ class Settings implements Stringable * example="username" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $mail_smtp_username = ''; public function getMailSmtpUsername(): string @@ -1014,7 +1014,7 @@ class Settings implements Stringable * example="password" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $mail_smtp_password = ''; public function getMailSmtpPassword(): string @@ -1052,7 +1052,7 @@ class Settings implements Stringable * example="libravatar" * ) */ - #[ORM\Column(length: 25)] + #[ORM\Column(length: 25, nullable: true)] protected ?string $avatar_service = null; public function getAvatarService(): string @@ -1071,7 +1071,7 @@ class Settings implements Stringable * example="" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $avatar_default_url = null; public function getAvatarDefaultUrl(): string diff --git a/src/Entity/SftpUser.php b/src/Entity/SftpUser.php index 12aaf36fa..ebed1bdc7 100644 --- a/src/Entity/SftpUser.php +++ b/src/Entity/SftpUser.php @@ -20,7 +20,7 @@ class SftpUser use Traits\HasAutoIncrementId; #[ORM\ManyToOne(inversedBy: 'sftp_users')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; #[ORM\Column(length: 32)] @@ -33,7 +33,7 @@ class SftpUser #[Assert\NotBlank] protected string $password; - #[ORM\Column(name: 'public_keys', type: 'text')] + #[ORM\Column(name: 'public_keys', type: 'text', nullable: true)] protected ?string $publicKeys = null; public function __construct(Station $station) diff --git a/src/Entity/SongHistory.php b/src/Entity/SongHistory.php index 1c74d086d..e069f5a36 100644 --- a/src/Entity/SongHistory.php +++ b/src/Entity/SongHistory.php @@ -22,57 +22,57 @@ class SongHistory implements SongInterface /** @var int */ public const DEFAULT_DAYS_TO_KEEP = 60; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $station_id; #[ORM\ManyToOne(inversedBy: 'history')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $playlist_id = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'playlist_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'playlist_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?StationPlaylist $playlist = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $streamer_id = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'streamer_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'streamer_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?StationStreamer $streamer = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $media_id = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'media_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'media_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?StationMedia $media = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $request_id = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'request_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'request_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?StationRequest $request = null; #[ORM\Column] protected int $timestamp_start = 0; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $duration = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $listeners_start = null; #[ORM\Column] protected int $timestamp_end = 0; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $listeners_end = 0; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $unique_listeners = 0; #[ORM\Column] diff --git a/src/Entity/Station.php b/src/Entity/Station.php index 67519614e..1a0f464bd 100644 --- a/src/Entity/Station.php +++ b/src/Entity/Station.php @@ -48,7 +48,7 @@ class Station implements Stringable * example="AzuraTest Radio" * ) */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] #[Assert\NotBlank] protected ?string $name = null; @@ -58,7 +58,7 @@ class Station implements Stringable * example="azuratest_radio" * ) */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] #[Assert\NotBlank] protected ?string $short_name = null; @@ -77,7 +77,7 @@ class Station implements Stringable * example="icecast" * ) */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] #[Assert\Choice(choices: [Adapters::FRONTEND_ICECAST, Adapters::FRONTEND_REMOTE, Adapters::FRONTEND_SHOUTCAST])] protected ?string $frontend_type = Adapters::FRONTEND_ICECAST; @@ -97,7 +97,7 @@ class Station implements Stringable * example="liquidsoap" * ) */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] #[Assert\Choice(choices: [Adapters::BACKEND_LIQUIDSOAP, Adapters::BACKEND_NONE])] protected ?string $backend_type = Adapters::BACKEND_LIQUIDSOAP; @@ -111,39 +111,39 @@ class Station implements Stringable #[ORM\Column(type: 'json', nullable: true)] protected ?array $backend_config = null; - #[ORM\Column(length: 150)] + #[ORM\Column(length: 150, nullable: true)] #[Attributes\AuditIgnore] protected ?string $adapter_api_key = null; /** @OA\Property(example="A sample radio station.") */ - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $description = null; /** @OA\Property(example="https://demo.azuracast.com/") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $url = null; /** @OA\Property(example="Various") */ - #[ORM\Column(length: 150)] + #[ORM\Column(length: 150, nullable: true)] protected ?string $genre = null; /** @OA\Property(example="/var/azuracast/stations/azuratest_radio") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $radio_base_dir = null; #[ORM\Column(type: 'array', nullable: true)] #[Attributes\AuditIgnore] protected mixed $nowplaying; - #[ORM\Column] + #[ORM\Column(nullable: true)] #[Attributes\AuditIgnore] protected ?int $nowplaying_timestamp = null; /** @OA\Property(type="array", @OA\Items()) */ - #[ORM\Column(type: 'json')] + #[ORM\Column(type: 'json', nullable: true)] protected ?array $automation_settings = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] #[Attributes\AuditIgnore] protected ?int $automation_timestamp = 0; @@ -157,15 +157,15 @@ class Station implements Stringable protected bool $enable_requests = false; /** @OA\Property(example=5) */ - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $request_delay = self::DEFAULT_REQUEST_DELAY; /** @OA\Property(example=15) */ - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $request_threshold = self::DEFAULT_REQUEST_THRESHOLD; /** @OA\Property(example=0) */ - #[ORM\Column(options: ['default' => 0])] + #[ORM\Column(nullable: true, options: ['default' => 0])] protected ?int $disconnect_deactivate_streamer = self::DEFAULT_DISCONNECT_DEACTIVATE_STREAMER; /** @@ -237,7 +237,7 @@ class Station implements Stringable * example="UTC" * ) */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $timezone = 'UTC'; /** @@ -246,7 +246,7 @@ class Station implements Stringable * example="https://example.com/image.jpg" * ) */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $default_album_art_url = null; #[ORM\OneToMany(mappedBy: 'station', targetEntity: SongHistory::class)] @@ -254,19 +254,34 @@ class Station implements Stringable protected Collection $history; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'media_storage_location_id', referencedColumnName: 'id', onDelete: 'SET NULL')] + #[ORM\JoinColumn( + name: 'media_storage_location_id', + referencedColumnName: 'id', + nullable: true, + onDelete: 'SET NULL' + )] #[DeepNormalize(true)] #[Serializer\MaxDepth(1)] protected ?StorageLocation $media_storage_location = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'recordings_storage_location_id', referencedColumnName: 'id', onDelete: 'SET NULL')] + #[ORM\JoinColumn( + name: 'recordings_storage_location_id', + referencedColumnName: 'id', + nullable: true, + onDelete: 'SET NULL' + )] #[DeepNormalize(true)] #[Serializer\MaxDepth(1)] protected ?StorageLocation $recordings_storage_location = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'podcasts_storage_location_id', referencedColumnName: 'id', onDelete: 'SET NULL')] + #[ORM\JoinColumn( + name: 'podcasts_storage_location_id', + referencedColumnName: 'id', + nullable: true, + onDelete: 'SET NULL' + )] #[DeepNormalize(true)] #[Serializer\MaxDepth(1)] protected ?StorageLocation $podcasts_storage_location = null; @@ -274,11 +289,11 @@ class Station implements Stringable #[ORM\OneToMany(mappedBy: 'station', targetEntity: StationStreamer::class)] protected Collection $streamers; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $current_streamer_id = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'current_streamer_id', referencedColumnName: 'id', onDelete: 'SET NULL')] + #[ORM\JoinColumn(name: 'current_streamer_id', referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')] protected ?StationStreamer $current_streamer = null; #[ORM\OneToMany(mappedBy: 'station', targetEntity: RolePermission::class)] diff --git a/src/Entity/StationMedia.php b/src/Entity/StationMedia.php index e8b23acbe..c0ebe0d4d 100644 --- a/src/Entity/StationMedia.php +++ b/src/Entity/StationMedia.php @@ -39,14 +39,14 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example="69b536afc7ebbf16457b8645" * ) */ - #[ORM\Column(length: 25)] + #[ORM\Column(length: 25, nullable: true)] protected ?string $unique_id = null; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $storage_location_id; #[ORM\ManyToOne(inversedBy: 'media')] - #[ORM\JoinColumn(name: 'storage_location_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'storage_location_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StorageLocation $storage_location; /** @@ -55,7 +55,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example="Test Album" * ) */ - #[ORM\Column(length: 200)] + #[ORM\Column(length: 200, nullable: true)] protected ?string $album = null; /** @@ -64,7 +64,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example="Rock" * ) */ - #[ORM\Column(length: 30)] + #[ORM\Column(length: 30, nullable: true)] protected ?string $genre = null; /** @@ -73,7 +73,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example="...Never gonna give you up..." * ) */ - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $lyrics = null; /** @@ -82,7 +82,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example="GBARL0600786" * ) */ - #[ORM\Column(length: 15)] + #[ORM\Column(length: 15, nullable: true)] protected ?string $isrc = null; /** @@ -91,7 +91,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example=240.00 * ) */ - #[ORM\Column(type: 'decimal', precision: 7, scale: 2)] + #[ORM\Column(type: 'decimal', precision: 7, scale: 2, nullable: true)] protected ?float $length = 0.00; /** @@ -100,7 +100,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example="4:00" * ) */ - #[ORM\Column(length: 10)] + #[ORM\Column(length: 10, nullable: true)] protected ?string $length_text = '0:00'; /** @@ -118,7 +118,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example=SAMPLE_TIMESTAMP * ) */ - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $mtime = 0; /** @@ -127,7 +127,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example=-14.00 * ) */ - #[ORM\Column(type: 'decimal', precision: 6, scale: 1)] + #[ORM\Column(type: 'decimal', precision: 6, scale: 1, nullable: true)] protected ?float $amplify = null; /** @@ -136,7 +136,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example=2.00 * ) */ - #[ORM\Column(type: 'decimal', precision: 6, scale: 1)] + #[ORM\Column(type: 'decimal', precision: 6, scale: 1, nullable: true)] protected ?float $fade_overlap = null; /** @@ -145,7 +145,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example=3.00 * ) */ - #[ORM\Column(type: 'decimal', precision: 6, scale: 1)] + #[ORM\Column(type: 'decimal', precision: 6, scale: 1, nullable: true)] protected ?float $fade_in = null; /** @@ -154,7 +154,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example=3.00 * ) */ - #[ORM\Column(type: 'decimal', precision: 6, scale: 1)] + #[ORM\Column(type: 'decimal', precision: 6, scale: 1, nullable: true)] protected ?float $fade_out = null; /** @@ -163,7 +163,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example=30.00 * ) */ - #[ORM\Column(type: 'decimal', precision: 6, scale: 1)] + #[ORM\Column(type: 'decimal', precision: 6, scale: 1, nullable: true)] protected ?float $cue_in = null; /** @@ -172,7 +172,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar * example=30.00 * ) */ - #[ORM\Column(type: 'decimal', precision: 6, scale: 1)] + #[ORM\Column(type: 'decimal', precision: 6, scale: 1, nullable: true)] protected ?float $cue_out = null; /** diff --git a/src/Entity/StationMediaCustomField.php b/src/Entity/StationMediaCustomField.php index 921fa80ce..752e1c2c4 100644 --- a/src/Entity/StationMediaCustomField.php +++ b/src/Entity/StationMediaCustomField.php @@ -15,21 +15,21 @@ class StationMediaCustomField use Traits\HasAutoIncrementId; use Traits\TruncateStrings; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $media_id; #[ORM\ManyToOne(inversedBy: 'metadata')] - #[ORM\JoinColumn(name: 'media_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'media_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StationMedia $media; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $field_id; #[ORM\ManyToOne(inversedBy: 'media_fields')] - #[ORM\JoinColumn(name: 'field_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'field_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected CustomField $field; - #[ORM\Column(name: 'field_value', length: 255)] + #[ORM\Column(name: 'field_value', length: 255, nullable: true)] protected ?string $value = null; public function __construct(StationMedia $media, CustomField $field) diff --git a/src/Entity/StationMount.php b/src/Entity/StationMount.php index a5ab79d80..17133a3b1 100644 --- a/src/Entity/StationMount.php +++ b/src/Entity/StationMount.php @@ -24,11 +24,11 @@ class StationMount implements StationMountInterface, \Stringable use Traits\HasAutoIncrementId; use Traits\TruncateStrings; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $station_id; #[ORM\ManyToOne(inversedBy: 'mounts')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; /** @OA\Property(example="/radio.mp3") */ @@ -37,7 +37,7 @@ class StationMount implements StationMountInterface, \Stringable protected string $name = ''; /** @OA\Property(example="128kbps MP3") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $display_name = null; /** @OA\Property(example=true) */ @@ -53,15 +53,15 @@ class StationMount implements StationMountInterface, \Stringable protected bool $is_public = false; /** @OA\Property(example="/error.mp3") */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $fallback_mount = null; /** @OA\Property(example="http://radio.example.com:8000/radio.mp3") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $relay_url = null; /** @OA\Property(example="") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $authhash = null; /** @OA\Property(example=true) */ @@ -69,19 +69,19 @@ class StationMount implements StationMountInterface, \Stringable protected bool $enable_autodj = true; /** @OA\Property(example="mp3") */ - #[ORM\Column(length: 10)] + #[ORM\Column(length: 10, nullable: true)] protected ?string $autodj_format = 'mp3'; /** @OA\Property(example=128) */ - #[ORM\Column(type: 'smallint')] + #[ORM\Column(type: 'smallint', nullable: true)] protected ?int $autodj_bitrate = 128; /** @OA\Property(example="https://custom-listen-url.example.com/stream.mp3") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $custom_listen_url = null; /** @OA\Property(type="array", @OA\Items()) */ - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $frontend_config = null; /** diff --git a/src/Entity/StationPlaylist.php b/src/Entity/StationPlaylist.php index 93b419277..47b411627 100644 --- a/src/Entity/StationPlaylist.php +++ b/src/Entity/StationPlaylist.php @@ -50,11 +50,11 @@ class StationPlaylist implements Stringable public const OPTION_PLAY_SINGLE_TRACK = 'single_track'; public const OPTION_MERGE = 'merge'; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $station_id; #[ORM\ManyToOne(inversedBy: 'playlists')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; /** @OA\Property(example="Test Playlist") */ @@ -84,11 +84,11 @@ class StationPlaylist implements Stringable protected string $order = self::ORDER_SHUFFLE; /** @OA\Property(example="http://remote-url.example.com/stream.mp3") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $remote_url = null; /** @OA\Property(example="stream") */ - #[ORM\Column(length: 25)] + #[ORM\Column(length: 25, nullable: true)] #[Assert\Choice(choices: [self::REMOTE_TYPE_STREAM, self::REMOTE_TYPE_PLAYLIST])] protected ?string $remote_type = self::REMOTE_TYPE_STREAM; @@ -148,7 +148,7 @@ class StationPlaylist implements Stringable protected bool $include_in_automation = false; /** @OA\Property(example="interrupt,loop_once,single_track,merge") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $backend_options = ''; /** @OA\Property(example=true) */ diff --git a/src/Entity/StationPlaylistFolder.php b/src/Entity/StationPlaylistFolder.php index cca99d001..086ff844a 100644 --- a/src/Entity/StationPlaylistFolder.php +++ b/src/Entity/StationPlaylistFolder.php @@ -17,11 +17,11 @@ class StationPlaylistFolder implements PathAwareInterface use Traits\TruncateStrings; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; #[ORM\ManyToOne(fetch: 'EAGER', inversedBy: 'folders')] - #[ORM\JoinColumn(name: 'playlist_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'playlist_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StationPlaylist $playlist; #[ORM\Column(length: 500)] diff --git a/src/Entity/StationPlaylistMedia.php b/src/Entity/StationPlaylistMedia.php index 43dc033ba..745cca580 100644 --- a/src/Entity/StationPlaylistMedia.php +++ b/src/Entity/StationPlaylistMedia.php @@ -15,18 +15,18 @@ class StationPlaylistMedia implements JsonSerializable { use Traits\HasAutoIncrementId; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $playlist_id; #[ORM\ManyToOne(fetch: 'EAGER', inversedBy: 'media_items')] - #[ORM\JoinColumn(name: 'playlist_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'playlist_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StationPlaylist $playlist; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $media_id; #[ORM\ManyToOne(fetch: 'EAGER', inversedBy: 'playlists')] - #[ORM\JoinColumn(name: 'media_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'media_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StationMedia $media; #[ORM\Column] diff --git a/src/Entity/StationQueue.php b/src/Entity/StationQueue.php index e7a4e6562..d336fa5d1 100644 --- a/src/Entity/StationQueue.php +++ b/src/Entity/StationQueue.php @@ -17,44 +17,44 @@ class StationQueue implements SongInterface use Traits\TruncateInts; use Traits\HasSongFields; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $station_id; #[ORM\ManyToOne(inversedBy: 'history')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $playlist_id = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'playlist_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'playlist_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?StationPlaylist $playlist = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $media_id = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'media_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'media_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?StationMedia $media = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $request_id = null; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'request_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'request_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?StationRequest $request = null; #[ORM\Column] protected bool $sent_to_autodj = false; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $autodj_custom_uri = null; #[ORM\Column] protected int $timestamp_cued; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $duration = null; #[ORM\Column(type: 'json', nullable: true)] diff --git a/src/Entity/StationRemote.php b/src/Entity/StationRemote.php index 660fc3186..03b35eaec 100644 --- a/src/Entity/StationRemote.php +++ b/src/Entity/StationRemote.php @@ -28,22 +28,22 @@ class StationRemote implements StationMountInterface, Stringable use Traits\HasAutoIncrementId; use Traits\TruncateStrings; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $station_id; #[ORM\ManyToOne(inversedBy: 'remotes')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $relay_id = null; #[ORM\ManyToOne(inversedBy: 'remotes')] - #[ORM\JoinColumn(name: 'relay_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'relay_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] protected ?Relay $relay = null; /** @OA\Property(example="128kbps MP3") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $display_name = null; /** @OA\Property(example=true) */ @@ -60,43 +60,43 @@ class StationRemote implements StationMountInterface, Stringable protected bool $enable_autodj = false; /** @OA\Property(example="mp3") */ - #[ORM\Column(length: 10)] + #[ORM\Column(length: 10, nullable: true)] protected ?string $autodj_format = null; /** @OA\Property(example=128) */ - #[ORM\Column(type: 'smallint')] + #[ORM\Column(type: 'smallint', nullable: true)] protected ?int $autodj_bitrate = null; /** @OA\Property(example="https://custom-listen-url.example.com/stream.mp3") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $custom_listen_url = null; /** @OA\Property(example="http://custom-url.example.com") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $url = null; /** @OA\Property(example="/stream.mp3") */ - #[ORM\Column(length: 150)] + #[ORM\Column(length: 150, nullable: true)] protected ?string $mount = null; /** @OA\Property(example="password") */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $admin_password = null; /** @OA\Property(example=8000) */ - #[ORM\Column(type: 'smallint', options: ['unsigned' => true])] + #[ORM\Column(type: 'smallint', nullable: true, options: ['unsigned' => true])] protected ?int $source_port = null; /** @OA\Property(example="/") */ - #[ORM\Column(length: 150)] + #[ORM\Column(length: 150, nullable: true)] protected ?string $source_mount = null; /** @OA\Property(example="source") */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $source_username = null; /** @OA\Property(example="password") */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $source_password = null; /** @OA\Property(example=false) */ diff --git a/src/Entity/StationRequest.php b/src/Entity/StationRequest.php index 820ab326a..d2b24102c 100644 --- a/src/Entity/StationRequest.php +++ b/src/Entity/StationRequest.php @@ -17,18 +17,18 @@ class StationRequest { use Traits\HasAutoIncrementId; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $station_id; #[ORM\ManyToOne(inversedBy: 'media')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $track_id; #[ORM\ManyToOne] - #[ORM\JoinColumn(name: 'track_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'track_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StationMedia $track; #[ORM\Column] diff --git a/src/Entity/StationSchedule.php b/src/Entity/StationSchedule.php index 7f3519ab7..ac201980f 100644 --- a/src/Entity/StationSchedule.php +++ b/src/Entity/StationSchedule.php @@ -37,10 +37,10 @@ class StationSchedule #[ORM\Column(type: 'smallint')] protected int $end_time = 0; - #[ORM\Column(length: 10)] + #[ORM\Column(length: 10, nullable: true)] protected ?string $start_date = null; - #[ORM\Column(length: 10)] + #[ORM\Column(length: 10, nullable: true)] protected ?string $end_date = null; /** @@ -49,7 +49,7 @@ class StationSchedule * example="0,1,2,3" * ) */ - #[ORM\Column(length: 50)] + #[ORM\Column(length: 50, nullable: true)] protected ?string $days = null; public function __construct(StationPlaylist|StationStreamer $relation) diff --git a/src/Entity/StationStreamer.php b/src/Entity/StationStreamer.php index 946324497..ff4318673 100644 --- a/src/Entity/StationStreamer.php +++ b/src/Entity/StationStreamer.php @@ -34,11 +34,11 @@ class StationStreamer implements \Stringable use Traits\HasAutoIncrementId; use Traits\TruncateStrings; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $station_id; #[ORM\ManyToOne(inversedBy: 'streamers')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; /** @OA\Property(example="dj_test") */ @@ -53,11 +53,11 @@ class StationStreamer implements \Stringable protected string $streamer_password; /** @OA\Property(example="Test DJ") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $display_name = null; /** @OA\Property(example="This is a test DJ account.") */ - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $comments = null; /** @OA\Property(example=true) */ @@ -69,7 +69,7 @@ class StationStreamer implements \Stringable protected bool $enforce_schedule = false; /** @OA\Property(example=SAMPLE_TIMESTAMP) */ - #[ORM\Column] + #[ORM\Column(nullable: true)] #[Attributes\AuditIgnore] protected ?int $reactivate_at = null; diff --git a/src/Entity/StationStreamerBroadcast.php b/src/Entity/StationStreamerBroadcast.php index 7e5e27b6c..484569fb9 100644 --- a/src/Entity/StationStreamerBroadcast.php +++ b/src/Entity/StationStreamerBroadcast.php @@ -24,11 +24,11 @@ class StationStreamerBroadcast use Traits\TruncateStrings; #[ORM\ManyToOne(inversedBy: 'streamer_broadcasts')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; #[ORM\ManyToOne(inversedBy: 'broadcasts')] - #[ORM\JoinColumn(name: 'streamer_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'streamer_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StationStreamer $streamer; #[ORM\Column(name: 'timestamp_start')] @@ -37,7 +37,7 @@ class StationStreamerBroadcast #[ORM\Column(name: 'timestamp_end')] protected int $timestampEnd = 0; - #[ORM\Column(name: 'recording_path', length: 255)] + #[ORM\Column(name: 'recording_path', length: 255, nullable: true)] protected ?string $recordingPath = null; public function __construct(StationStreamer $streamer) diff --git a/src/Entity/StationWebhook.php b/src/Entity/StationWebhook.php index 85b75e6e2..e2c9f86c5 100644 --- a/src/Entity/StationWebhook.php +++ b/src/Entity/StationWebhook.php @@ -34,11 +34,11 @@ class StationWebhook implements Stringable public const TRIGGER_STATION_OFFLINE = 'station_offline'; public const TRIGGER_STATION_ONLINE = 'station_online'; - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $station_id; #[ORM\ManyToOne(inversedBy: 'webhooks')] - #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'station_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected Station $station; /** @@ -47,7 +47,7 @@ class StationWebhook implements Stringable * example="Twitter Post" * ) */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $name = null; /** diff --git a/src/Entity/StorageLocation.php b/src/Entity/StorageLocation.php index 09fb26fb5..61afe3d65 100644 --- a/src/Entity/StorageLocation.php +++ b/src/Entity/StorageLocation.php @@ -63,37 +63,37 @@ class StorageLocation implements Stringable ])] protected string $adapter = self::ADAPTER_LOCAL; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] protected ?string $path = null; - #[ORM\Column(name: 's3_credential_key', length: 255)] + #[ORM\Column(name: 's3_credential_key', length: 255, nullable: true)] protected ?string $s3CredentialKey = null; - #[ORM\Column(name: 's3_credential_secret', length: 255)] + #[ORM\Column(name: 's3_credential_secret', length: 255, nullable: true)] protected ?string $s3CredentialSecret = null; - #[ORM\Column(name: 's3_region', length: 150)] + #[ORM\Column(name: 's3_region', length: 150, nullable: true)] protected ?string $s3Region = null; - #[ORM\Column(name: 's3_version', length: 150)] + #[ORM\Column(name: 's3_version', length: 150, nullable: true)] protected ?string $s3Version = 'latest'; - #[ORM\Column(name: 's3_bucket', length: 255)] + #[ORM\Column(name: 's3_bucket', length: 255, nullable: true)] protected ?string $s3Bucket = null; - #[ORM\Column(name: 's3_endpoint', length: 255)] + #[ORM\Column(name: 's3_endpoint', length: 255, nullable: true)] protected ?string $s3Endpoint = null; - #[ORM\Column(name: 'dropbox_auth_token', length: 255)] + #[ORM\Column(name: 'dropbox_auth_token', length: 255, nullable: true)] protected ?string $dropboxAuthToken = null; - #[ORM\Column(name: 'storage_quota', type: 'bigint')] + #[ORM\Column(name: 'storage_quota', type: 'bigint', nullable: true)] protected ?string $storageQuota = null; // Used for API generation. protected ?string $storageQuotaBytes = null; - #[ORM\Column(name: 'storage_used', type: 'bigint')] + #[ORM\Column(name: 'storage_used', type: 'bigint', nullable: true)] #[Attributes\AuditIgnore] protected ?string $storageUsed = null; diff --git a/src/Entity/Traits/HasAutoIncrementId.php b/src/Entity/Traits/HasAutoIncrementId.php index 7d9e4cdce..38c4e0d78 100644 --- a/src/Entity/Traits/HasAutoIncrementId.php +++ b/src/Entity/Traits/HasAutoIncrementId.php @@ -11,11 +11,12 @@ use OpenApi\Annotations as OA; trait HasAutoIncrementId { /** @OA\Property() */ - #[ORM\Column, ORM\Id, ORM\GeneratedValue] - protected int $id; + #[ORM\Column(nullable: false)] + #[ORM\Id, ORM\GeneratedValue] + protected ?int $id = null; public function getId(): ?int { - return $this->id ?? null; + return $this->id; } } diff --git a/src/Entity/Traits/HasSongFields.php b/src/Entity/Traits/HasSongFields.php index a89ce7c75..a25a211e2 100644 --- a/src/Entity/Traits/HasSongFields.php +++ b/src/Entity/Traits/HasSongFields.php @@ -18,15 +18,15 @@ trait HasSongFields protected string $song_id; /** @OA\Property() */ - #[ORM\Column(length: 303)] + #[ORM\Column(length: 303, nullable: true)] protected ?string $text = null; /** @OA\Property() */ - #[ORM\Column(length: 150)] + #[ORM\Column(length: 150, nullable: true)] protected ?string $artist = null; /** @OA\Property() */ - #[ORM\Column(length: 150)] + #[ORM\Column(length: 150, nullable: true)] protected ?string $title = null; public function setSong(SongInterface $song): void diff --git a/src/Entity/Traits/HasUniqueId.php b/src/Entity/Traits/HasUniqueId.php index fe0d2757e..9b19f85f7 100644 --- a/src/Entity/Traits/HasUniqueId.php +++ b/src/Entity/Traits/HasUniqueId.php @@ -12,12 +12,12 @@ use OpenApi\Annotations as OA; trait HasUniqueId { /** @OA\Property() */ - #[ORM\Column(type: 'guid', unique: true)] + #[ORM\Column(type: 'guid', unique: true, nullable: false)] #[ORM\Id, ORM\GeneratedValue(strategy: 'CUSTOM'), ORM\CustomIdGenerator(UuidV6Generator::class)] - protected string $id; + protected ?string $id = null; public function getId(): ?string { - return $this->id ?? null; + return $this->id; } } diff --git a/src/Entity/UnprocessableMedia.php b/src/Entity/UnprocessableMedia.php index 746f16727..b94351748 100644 --- a/src/Entity/UnprocessableMedia.php +++ b/src/Entity/UnprocessableMedia.php @@ -19,20 +19,20 @@ class UnprocessableMedia implements ProcessableMediaInterface, PathAwareInterfac public const REPROCESS_THRESHOLD_MINIMUM = 604800; // One week - #[ORM\Column] + #[ORM\Column(nullable: false)] protected int $storage_location_id; #[ORM\ManyToOne(inversedBy: 'media')] - #[ORM\JoinColumn(name: 'storage_location_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'storage_location_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected StorageLocation $storage_location; #[ORM\Column(length: 500)] protected string $path; - #[ORM\Column] + #[ORM\Column(nullable: true)] protected ?int $mtime = 0; - #[ORM\Column(type: 'text')] + #[ORM\Column(type: 'text', nullable: true)] protected ?string $error = null; public function __construct(StorageLocation $storageLocation, string $path) diff --git a/src/Entity/User.php b/src/Entity/User.php index 969acbfe6..6ff7d14ad 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -34,12 +34,12 @@ class User implements Stringable use Traits\TruncateStrings; /** @OA\Property(example="demo@azuracast.com") */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] #[Assert\NotBlank] #[Assert\Email] protected ?string $email = null; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] #[Attributes\AuditIgnore] protected ?string $auth_password = null; @@ -47,20 +47,20 @@ class User implements Stringable protected ?string $new_password = null; /** @OA\Property(example="Demo Account") */ - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, nullable: true)] protected ?string $name = null; /** @OA\Property(example="en_US") */ - #[ORM\Column(length: 25)] + #[ORM\Column(length: 25, nullable: true)] protected ?string $locale = null; /** @OA\Property(example="dark") */ - #[ORM\Column(length: 25)] + #[ORM\Column(length: 25, nullable: true)] #[Attributes\AuditIgnore] protected ?string $theme = null; /** @OA\Property(example="A1B2C3D4") */ - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] #[Attributes\AuditIgnore] protected ?string $two_factor_secret = null; diff --git a/src/Entity/UserLoginToken.php b/src/Entity/UserLoginToken.php index b7e50caf8..d44a19f41 100644 --- a/src/Entity/UserLoginToken.php +++ b/src/Entity/UserLoginToken.php @@ -16,7 +16,7 @@ class UserLoginToken use Traits\HasSplitTokenFields; #[ORM\ManyToOne(fetch: 'EAGER', inversedBy: 'api_keys')] - #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] protected User $user; #[ORM\Column]