Minor: Format code - refs BT#21568

pull/5949/head
Angel Fernando Quiroz Campos 9 months ago
parent 86ba829996
commit e003ffc01d
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 70
      src/CoreBundle/Entity/ExtraField.php

@ -21,7 +21,21 @@ use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
#[ApiResource(operations: [new Get(security: 'is_granted(\'ROLE_ADMIN\')'), new Put(security: 'is_granted(\'ROLE_ADMIN\')'), new GetCollection(security: 'is_granted(\'ROLE_ADMIN\')'), new Post(security: 'is_granted(\'ROLE_ADMIN\')')], security: 'is_granted(\'ROLE_ADMIN\')', denormalizationContext: ['groups' => ['extra_field:write']], normalizationContext: ['groups' => ['extra_field:read']])] #[ApiResource(
operations: [
new Get(security: "is_granted('ROLE_ADMIN')"),
new Put(security: "is_granted('ROLE_ADMIN')"),
new GetCollection(security: "is_granted('ROLE_ADMIN')"),
new Post(security: "is_granted('ROLE_ADMIN')"),
],
normalizationContext: [
'groups' => ['extra_field:read'],
],
denormalizationContext: [
'groups' => ['extra_field:write'],
],
security: "is_granted('ROLE_ADMIN')"),
]
#[ORM\Table(name: 'extra_field')] #[ORM\Table(name: 'extra_field')]
#[ORM\Entity] #[ORM\Entity]
#[ORM\MappedSuperclass] #[ORM\MappedSuperclass]
@ -79,51 +93,63 @@ class ExtraField
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue] #[ORM\GeneratedValue]
protected ?int $id = null; protected ?int $id = null;
#[Groups(['extra_field:read', 'extra_field:write'])] #[Groups(['extra_field:read', 'extra_field:write'])]
#[ORM\Column(name: 'item_type', type: 'integer')] #[ORM\Column(name: 'item_type', type: 'integer')]
protected int $itemType; protected int $itemType;
#[Groups(['extra_field:read', 'extra_field:write'])] #[Groups(['extra_field:read', 'extra_field:write'])]
#[ORM\Column(name: 'value_type', type: 'integer')] #[ORM\Column(name: 'value_type', type: 'integer')]
protected int $valueType; protected int $valueType;
#[Assert\NotBlank] #[Assert\NotBlank]
#[Groups(['extra_field:read', 'extra_field:write'])] #[Groups(['extra_field:read', 'extra_field:write'])]
#[ORM\Column(name: 'variable', type: 'string', length: 255)] #[ORM\Column(name: 'variable', type: 'string', length: 255)]
protected string $variable; protected string $variable;
#[Groups(['extra_field:read', 'extra_field:write'])] #[Groups(['extra_field:read', 'extra_field:write'])]
#[ORM\Column(name: 'description', type: 'text', nullable: true)] #[ORM\Column(name: 'description', type: 'text', nullable: true)]
protected ?string $description; protected ?string $description;
#[Assert\NotBlank] #[Assert\NotBlank]
#[Groups(['extra_field:read', 'extra_field:write'])] #[Groups(['extra_field:read', 'extra_field:write'])]
#[Gedmo\Translatable] #[Gedmo\Translatable]
#[ORM\Column(name: 'display_text', type: 'string', length: 255, nullable: true, unique: false)] #[ORM\Column(name: 'display_text', type: 'string', length: 255, unique: false, nullable: true)]
protected ?string $displayText = null; protected ?string $displayText = null;
#[ORM\Column(name: 'helper_text', type: 'text', nullable: true, unique: false)]
#[ORM\Column(name: 'helper_text', type: 'text', unique: false, nullable: true)]
protected ?string $helperText = null; protected ?string $helperText = null;
#[ORM\Column(name: 'default_value', type: 'text', nullable: true, unique: false)]
#[ORM\Column(name: 'default_value', type: 'text', unique: false, nullable: true)]
protected ?string $defaultValue = null; protected ?string $defaultValue = null;
#[ORM\Column(name: 'field_order', type: 'integer', nullable: true, unique: false)]
#[ORM\Column(name: 'field_order', type: 'integer', unique: false, nullable: true)]
protected ?int $fieldOrder = null; protected ?int $fieldOrder = null;
#[ORM\Column(name: 'visible_to_self', type: 'boolean', nullable: true, unique: false)]
#[ORM\Column(name: 'visible_to_self', type: 'boolean', unique: false, nullable: true)]
protected ?bool $visibleToSelf = false; protected ?bool $visibleToSelf = false;
#[ORM\Column(name: 'visible_to_others', type: 'boolean', nullable: true, unique: false)] #[ORM\Column(name: 'visible_to_others', type: 'boolean', unique: false, nullable: true)]
protected ?bool $visibleToOthers = false; protected ?bool $visibleToOthers = false;
#[ORM\Column(name: 'changeable', type: 'boolean', nullable: true, unique: false)]
#[ORM\Column(name: 'changeable', type: 'boolean', unique: false, nullable: true)]
protected ?bool $changeable = false; protected ?bool $changeable = false;
#[ORM\Column(name: 'filter', type: 'boolean', nullable: true, unique: false)]
#[ORM\Column(name: 'filter', type: 'boolean', unique: false, nullable: true)]
protected ?bool $filter = false; protected ?bool $filter = false;
/** /**
* @var Collection<int, ExtraFieldOptions> * @var Collection<int, ExtraFieldOptions>
*/ */
#[Groups(['extra_field:read'])] #[Groups(['extra_field:read'])]
#[ORM\OneToMany(targetEntity: ExtraFieldOptions::class, mappedBy: 'field')] #[ORM\OneToMany(mappedBy: 'field', targetEntity: ExtraFieldOptions::class)]
protected Collection $options; protected Collection $options;
/** /**
* @var Collection<int, Tag> * @var Collection<int, Tag>
*/ */
#[ORM\OneToMany(targetEntity: Tag::class, mappedBy: 'field')] #[ORM\OneToMany(mappedBy: 'field', targetEntity: Tag::class)]
protected Collection $tags; protected Collection $tags;
#[Gedmo\Timestampable(on: 'create')] #[Gedmo\Timestampable(on: 'create')]
#[ORM\Column(name: 'created_at', type: 'datetime')] #[ORM\Column(name: 'created_at', type: 'datetime')]
protected DateTime $createdAt; protected DateTime $createdAt;
@ -151,20 +177,24 @@ class ExtraField
{ {
return $this->id; return $this->id;
} }
public function getItemType(): int public function getItemType(): int
{ {
return $this->itemType; return $this->itemType;
} }
public function setItemType(int $itemType): self public function setItemType(int $itemType): self
{ {
$this->itemType = $itemType; $this->itemType = $itemType;
return $this; return $this;
} }
public function getValueType(): int public function getValueType(): int
{ {
return $this->valueType; return $this->valueType;
} }
public function setValueType(int $valueType): self public function setValueType(int $valueType): self
{ {
$this->valueType = $valueType; $this->valueType = $valueType;
@ -176,6 +206,7 @@ class ExtraField
{ {
return $this->variable; return $this->variable;
} }
public function setVariable(string $variable): self public function setVariable(string $variable): self
{ {
$this->variable = $variable; $this->variable = $variable;
@ -187,6 +218,7 @@ class ExtraField
{ {
return $this->displayText; return $this->displayText;
} }
public function setDisplayText(string $displayText): self public function setDisplayText(string $displayText): self
{ {
$this->displayText = $displayText; $this->displayText = $displayText;
@ -198,6 +230,7 @@ class ExtraField
{ {
return $this->defaultValue; return $this->defaultValue;
} }
public function setDefaultValue(string $defaultValue): self public function setDefaultValue(string $defaultValue): self
{ {
$this->defaultValue = $defaultValue; $this->defaultValue = $defaultValue;
@ -209,6 +242,7 @@ class ExtraField
{ {
return $this->fieldOrder; return $this->fieldOrder;
} }
public function setFieldOrder(int $fieldOrder): self public function setFieldOrder(int $fieldOrder): self
{ {
$this->fieldOrder = $fieldOrder; $this->fieldOrder = $fieldOrder;
@ -220,46 +254,55 @@ class ExtraField
{ {
return $this->changeable; return $this->changeable;
} }
public function setChangeable(bool $changeable): self public function setChangeable(bool $changeable): self
{ {
$this->changeable = $changeable; $this->changeable = $changeable;
return $this; return $this;
} }
public function isFilter(): bool public function isFilter(): bool
{ {
return $this->filter; return $this->filter;
} }
public function setFilter(bool $filter): self public function setFilter(bool $filter): self
{ {
$this->filter = $filter; $this->filter = $filter;
return $this; return $this;
} }
public function isVisibleToSelf(): bool public function isVisibleToSelf(): bool
{ {
return $this->visibleToSelf; return $this->visibleToSelf;
} }
public function setVisibleToSelf(bool $visibleToSelf): self public function setVisibleToSelf(bool $visibleToSelf): self
{ {
$this->visibleToSelf = $visibleToSelf; $this->visibleToSelf = $visibleToSelf;
return $this; return $this;
} }
public function isVisibleToOthers(): bool public function isVisibleToOthers(): bool
{ {
return $this->visibleToOthers; return $this->visibleToOthers;
} }
public function setVisibleToOthers(bool $visibleToOthers): self public function setVisibleToOthers(bool $visibleToOthers): self
{ {
$this->visibleToOthers = $visibleToOthers; $this->visibleToOthers = $visibleToOthers;
return $this; return $this;
} }
public function getDescription(): ?string public function getDescription(): ?string
{ {
return $this->description; return $this->description;
} }
public function setDescription(string $description): self public function setDescription(string $description): self
{ {
$this->description = $description; $this->description = $description;
@ -274,6 +317,7 @@ class ExtraField
{ {
return $this->options; return $this->options;
} }
public function setOptions(Collection $options): self public function setOptions(Collection $options): self
{ {
$this->options = $options; $this->options = $options;
@ -288,6 +332,7 @@ class ExtraField
{ {
return $this->tags; return $this->tags;
} }
public function setTags(Collection $tags): self public function setTags(Collection $tags): self
{ {
$this->tags = $tags; $this->tags = $tags;
@ -302,6 +347,7 @@ class ExtraField
return $this->tags->exists(fn ($key, Tag $tag) => $tagName === $tag->getTag()); return $this->tags->exists(fn ($key, Tag $tag) => $tagName === $tag->getTag());
} }
public function getTypeToString(): string public function getTypeToString(): string
{ {
return match ($this->getItemType()) { return match ($this->getItemType()) {
@ -309,10 +355,12 @@ class ExtraField
default => 'text', default => 'text',
}; };
} }
public function getHelperText(): string public function getHelperText(): string
{ {
return $this->helperText; return $this->helperText;
} }
public function setHelperText(string $helperText): self public function setHelperText(string $helperText): self
{ {
$this->helperText = $helperText; $this->helperText = $helperText;

Loading…
Cancel
Save