src/Entity/ActionShock.php line 15
<?php
namespace App\Entity;
use App\Repository\ActionShockRepository;
use Doctrine\ORM\Mapping as ORM;
enum ActionShockType: string
{
case SHOCK_ACTION = 'shock_action';
case RED_PRICE = 'red_price';
}
#[ORM\Entity(repositoryClass: ActionShockRepository::class)]
class ActionShock
{
const TYPES = [ActionShockType::SHOCK_ACTION->value => 'Action "CHOC"', ActionShockType::RED_PRICE->value => 'Prix Rouge'];
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: Products::class, inversedBy: 'actionShockCalendar', fetch: 'EAGER')]
private $product;
#[ORM\Column(name: 'dateStart', type: 'date', nullable: true)]
private ?\DateTime $dateStart;
#[ORM\Column(name: 'dateEnd', type: 'date', nullable: true)]
private ?\DateTime $dateEnd;
#[ORM\Column(name: 'image', type: 'text', nullable: true)]
private ?string $image;
#[ORM\Column(type: "string", enumType: ActionShockType::class, options: ['default' => ActionShockType::SHOCK_ACTION])]
private ?ActionShockType $type = ActionShockType::SHOCK_ACTION;
#[ORM\Column(name: 'discountPercent', type: 'float', options: ['default' => 25])]
private ?float $discountPercent = 25;
public function getId(): ?int
{
return $this->id;
}
/**
* @return mixed
*/
public function getProduct()
{
return $this->product;
}
/**
* @param mixed $product
*/
public function setProduct($product): void
{
$this->product = $product;
}
/**
* @return \DateTime|null
*/
public function getDateStart(): ?\DateTime
{
return $this->dateStart;
}
/**
* @param \DateTime|null $dateStart
*/
public function setDateStart(?\DateTime $dateStart): void
{
$this->dateStart = $dateStart;
}
/**
* @return \DateTime|null
*/
public function getDateEnd(): ?\DateTime
{
return $this->dateEnd;
}
/**
* @param \DateTime|null $dateEnd
*/
public function setDateEnd(?\DateTime $dateEnd): void
{
$this->dateEnd = $dateEnd;
}
/**
* @return string|null
*/
public function getImage(): ?string
{
return $this->image;
}
/**
* @param string|null $image
*/
public function setImage(?string $image): void
{
$this->image = $image;
}
public function getType(): ?ActionShockType
{
return $this->type;
}
public function setType(ActionShockType $type): void
{
$this->type = $type;
}
public function getDiscountPercent(): ?float
{
return $this->discountPercent;
}
public function setDiscountPercent(float $discountPercent): void
{
$this->discountPercent = $discountPercent;
}
}