This commit is contained in:
2023-05-01 21:22:56 +02:00
parent 07c681fcec
commit 737f5f9275
2 changed files with 22 additions and 23 deletions

View File

@@ -23,10 +23,9 @@ use Doctrine\ORM\Mapping as ORM;
class ActivityReason
{
/**
* @var bool
* @ORM\Column(type="boolean")
*/
private $active = true;
private bool $active = true;
/**
* @var ActivityReasonCategory
@@ -34,7 +33,7 @@ class ActivityReason
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
* inversedBy="reasons")
*/
private $category;
private ?ActivityReasonCategory $category = null;
/**
* @var int
@@ -43,13 +42,13 @@ class ActivityReason
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
private ?int $id = null;
/**
* @var array
* @ORM\Column(type="json")
*/
private $name;
private array $name;
/**
* Get active.
@@ -81,25 +80,9 @@ class ActivityReason
/**
* Get name.
*
* @param mixed|null $locale
*/
public function getName($locale = null): array|string
public function getName(): array
{
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
}
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
return '';
}
return $this->name;
}