src/Flexy/ShopBundle/Entity/Resource/AgentObjective.php line 14
- <?php
- namespace App\Flexy\ShopBundle\Entity\Resource;
- use ApiPlatform\Metadata\ApiResource;
- use App\Repository\Flexy\ShopBundle\Entity\Resource\AgentObjectiveRepository;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\DBAL\Types\Types;
- use Doctrine\ORM\Mapping as ORM;
- #[ORM\Entity(repositoryClass: AgentObjectiveRepository::class)]
- #[ApiResource]
- class AgentObjective
- {
- #[ORM\Id]
- #[ORM\GeneratedValue]
- #[ORM\Column]
- private ?int $id = null;
- #[ORM\Column(nullable: true)]
- private ?int $minCustomers = null;
- #[ORM\Column(nullable: true)]
- private ?float $minRevenue = null;
- #[ORM\Column(nullable: true)]
- private ?int $duration = null;
- #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
- private ?\DateTimeInterface $createdAt = null;
- #[ORM\Column(type: Types::TEXT, nullable: true)]
- private ?string $description = null;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $name = null;
- #[ORM\OneToMany(mappedBy: 'agentObjective', targetEntity: Agent::class)]
- private Collection $agents;
- public function __construct()
- {
- $this->agents = new ArrayCollection();
- $this->createdAt = new \DateTime();
- }
- public function __toString()
- {
- return (string)$this->name;
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getMinCustomers(): ?int
- {
- return $this->minCustomers;
- }
- public function setMinCustomers(?int $minCustomers): self
- {
- $this->minCustomers = $minCustomers;
- return $this;
- }
- public function getMinRevenue(): ?float
- {
- return $this->minRevenue;
- }
- public function setMinRevenue(?float $minRevenue): self
- {
- $this->minRevenue = $minRevenue;
- return $this;
- }
- public function getDuration(): ?int
- {
- return $this->duration;
- }
- public function setDuration(?int $duration): self
- {
- $this->duration = $duration;
- return $this;
- }
- public function getCreatedAt(): ?\DateTimeInterface
- {
- return $this->createdAt;
- }
- public function setCreatedAt(?\DateTimeInterface $createdAt): self
- {
- $this->createdAt = $createdAt;
- return $this;
- }
- public function getDescription(): ?string
- {
- return $this->description;
- }
- public function setDescription(?string $description): self
- {
- $this->description = $description;
- return $this;
- }
- public function getName(): ?string
- {
- return $this->name;
- }
- public function setName(?string $name): self
- {
- $this->name = $name;
- return $this;
- }
- /**
- * @return Collection<int, Agent>
- */
- public function getAgents(): Collection
- {
- return $this->agents;
- }
- public function addAgent(Agent $agent): self
- {
- if (!$this->agents->contains($agent)) {
- $this->agents->add($agent);
- $agent->setAgentObjective($this);
- }
- return $this;
- }
- public function removeAgent(Agent $agent): self
- {
- if ($this->agents->removeElement($agent)) {
- // set the owning side to null (unless already changed)
- if ($agent->getAgentObjective() === $this) {
- $agent->setAgentObjective(null);
- }
- }
- return $this;
- }
- }