Release 2.45 (#5721)

Co-authored-by: Henning Klein <info@henningklein.de>
This commit is contained in:
Kevin Papst
2025-12-21 16:42:34 +01:00
committed by GitHub
parent 8c1ed68817
commit afb5a0bba4
67 changed files with 905 additions and 254 deletions

View File

@@ -11,6 +11,7 @@ namespace App\Entity;
use App\Constants;
use App\Export\Annotation as Exporter;
use App\Utils\Color;
use App\Validator\Constraints as Constraints;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
@@ -22,8 +23,7 @@ trait ColorTrait
* The assigned color in HTML hex format, e.g. #dd1d00
*/
#[ORM\Column(name: 'color', type: Types::STRING, length: 7, nullable: true)]
#[Serializer\Expose]
#[Serializer\Groups(['Default'])]
#[Serializer\Exclude]
#[Exporter\Expose(label: 'color')]
#[Constraints\HexColor]
private ?string $color = null;
@@ -46,4 +46,17 @@ trait ColorTrait
{
$this->color = $color;
}
abstract public function getName(): ?string;
/**
* Internal value: this color will never be empty and is generated by the tag name if not set explicit.
*/
#[Serializer\VirtualProperty]
#[Serializer\SerializedName('color')]
#[Serializer\Groups(['Default'])]
public function getColorSafe(): string
{
return $this->getColor() ?? (new Color())->getRandom($this->getName());
}
}