<?php
namespace App\Entity;
use App\Repository\ObjectCustomerRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ObjectCustomerRepository::class)
* @ORM\Table(name="object_customer",
* uniqueConstraints={
* @ORM\UniqueConstraint(name="object_customer_unique",
* columns={"customer_id", "object_id", "auction_id"})
* }
* )
*/
class ObjectCustomer
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="Customer")
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
*/
private $customer;
/**
* @ORM\Column(type="integer")
*/
private $object_id;
/**
* @ORM\Column(type="string")
*/
private $auction_id;
/**
* @ORM\OneToMany(targetEntity="AuctionBid", mappedBy="object_customer")
*/
private $bids;
/**
* @ORM\OneToMany(targetEntity=AuctionAutoBid::class, mappedBy="object_customer")
*/
private $auctionAutoBids;
/**
* @ORM\Column(type="boolean")
*/
private $winning = false;
/**
* @ORM\Column(type="integer")
*/
private $number;
public function __construct()
{
$this->bids = new ArrayCollection();
$this->auctionAutoBids = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCustomer(): Customer
{
return $this->customer;
}
public function setCustomer(Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function getObjectId(): ?int
{
return $this->object_id;
}
public function setObjectId(int $object_id): self
{
$this->object_id = $object_id;
return $this;
}
public function getAuctionId(): ?string
{
return $this->auction_id;
}
public function setAuctionId(string $auction_id): self
{
$this->auction_id = $auction_id;
return $this;
}
public function getBids(): ArrayCollection
{
return $this->bids;
}
/**
* @return Collection|AuctionAutoBid[]
*/
public function getAuctionAutoBids(): Collection
{
return $this->auctionAutoBids;
}
public function addAuctionAutoBid(AuctionAutoBid $auctionAutoBid): self
{
if (!$this->auctionAutoBids->contains($auctionAutoBid)) {
$this->auctionAutoBids[] = $auctionAutoBid;
$auctionAutoBid->setObjectCustomer($this);
}
return $this;
}
public function removeAuctionAutoBid(AuctionAutoBid $auctionAutoBid): self
{
if ($this->auctionAutoBids->removeElement($auctionAutoBid)) {
if ($auctionAutoBid->getObjectCustomer() === $this) {
$auctionAutoBid->setObjectCustomer(null);
}
}
return $this;
}
public function isWinning(): ?bool
{
return $this->winning;
}
public function setWinning(bool $winning): self
{
$this->winning = $winning;
return $this;
}
public function getNumber(): ?int
{
return $this->number;
}
public function setNumber(int $number): self
{
$this->number = $number;
return $this;
}
}