src/Flexy/ShopBundle/Entity/Order/DemandeFund.php line 13
<?php
namespace App\Flexy\ShopBundle\Entity\Order;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Flexy\ShopBundle\Repository\Order\DemandeFundRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ApiResource]
#[ORM\Entity(repositoryClass: DemandeFundRepository::class)]
class DemandeFund
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private ?\DateTimeImmutable $createdAt = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $comment = null;
#[ORM\OneToMany(targetEntity: Order::class, mappedBy: 'demandeFund', cascade: ['persist'], orphanRemoval: false)]
private \Doctrine\Common\Collections\Collection|array $orders;
public function __construct()
{
$this->orders = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
/**
* @return Collection|Order[]
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setDemandeFund($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getDemandeFund() === $this) {
$order->setDemandeFund(null);
}
}
return $this;
}
}