['commercial_report:read']], denormalizationContext: ['groups' => ['commercial_report:write']], order: ['occurredAt' => 'DESC'], )] #[ApiFilter(SearchFilter::class, properties: ['client' => 'exact', 'prospect' => 'exact'])] #[ORM\Entity(repositoryClass: DoctrineCommercialReportRepository::class)] #[ORM\Table(name: 'commercial_report')] class CommercialReport implements TimestampableInterface { use TimestampableBlamableTrait; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] #[Groups(['commercial_report:read'])] private ?int $id = null; #[ORM\Column(length: 255)] #[Groups(['commercial_report:read', 'commercial_report:write'])] private ?string $subject = null; #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups(['commercial_report:read', 'commercial_report:write'])] private ?string $body = null; #[ORM\Column(type: Types::DATE_IMMUTABLE)] #[Groups(['commercial_report:read', 'commercial_report:write'])] private ?DateTimeImmutable $occurredAt = null; #[ORM\Column(type: Types::STRING, length: 32, enumType: ReportType::class)] #[Groups(['commercial_report:read', 'commercial_report:write'])] private ReportType $type = ReportType::Note; #[ORM\ManyToOne(targetEntity: UserInterface::class)] #[ORM\JoinColumn(name: 'author_id', referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')] #[Groups(['commercial_report:read'])] private ?UserInterface $author = null; #[ORM\ManyToOne(targetEntity: Client::class)] #[ORM\JoinColumn(name: 'client_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] #[Groups(['commercial_report:read', 'commercial_report:write'])] private ?Client $client = null; #[ORM\ManyToOne(targetEntity: Prospect::class)] #[ORM\JoinColumn(name: 'prospect_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')] #[Groups(['commercial_report:read', 'commercial_report:write'])] private ?Prospect $prospect = null; /** @var Collection */ #[ORM\OneToMany(targetEntity: ReportDocument::class, mappedBy: 'commercialReport', cascade: ['remove'])] #[Groups(['commercial_report:read'])] private Collection $documents; public function __construct() { $this->documents = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getSubject(): ?string { return $this->subject; } public function setSubject(string $subject): static { $this->subject = $subject; return $this; } public function getBody(): ?string { return $this->body; } public function setBody(?string $body): static { $this->body = $body; return $this; } public function getOccurredAt(): ?DateTimeImmutable { return $this->occurredAt; } public function setOccurredAt(DateTimeImmutable $occurredAt): static { $this->occurredAt = $occurredAt; return $this; } public function getType(): ReportType { return $this->type; } public function setType(ReportType $type): static { $this->type = $type; return $this; } public function getAuthor(): ?UserInterface { return $this->author; } public function setAuthor(?UserInterface $author): static { $this->author = $author; return $this; } public function getClient(): ?Client { return $this->client; } public function setClient(?Client $client): static { $this->client = $client; return $this; } public function getProspect(): ?Prospect { return $this->prospect; } public function setProspect(?Prospect $prospect): static { $this->prospect = $prospect; return $this; } /** @return Collection */ public function getDocuments(): Collection { return $this->documents; } }