<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'shoparticle')]
#[ORM\Index(name: 'IX_articlenumber', columns: ['articlenumber'])]
#[ORM\Entity(repositoryClass: 'App\Entity\Repository\ShoparticleRepository')]
class Shoparticle
{
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
#[ORM\Column(type: 'string', nullable: true)]
private $articlenumber;
#[ORM\Column(type: 'string', nullable: true)]
private $title;
#[ORM\Column(type: 'string', nullable: true)]
private $type;
#[ORM\Column(type: 'text', nullable: true)]
private $description;
#[ORM\Column(type: 'decimal', nullable: true, precision: 6, scale: 2)]
private $price;
#[ORM\Column(type: 'integer', nullable: true)]
private $stock;
#[ORM\Column(type: 'boolean', nullable: true)]
private $available;
#[ORM\Column(type: 'string', nullable: true)]
private $image_url;
#[ORM\Column(type: 'string', nullable: true)]
private $manufacturer;
#[ORM\Column(type: 'integer', nullable: true)]
private $priority;
#[ORM\Column(type: 'boolean', nullable: true)]
private $is_organic;
#[ORM\Column(type: 'datetime', nullable: true)]
private $date_created;
#[ORM\OneToMany(targetEntity: 'App\Entity\ShoparticleCrop', mappedBy: 'shoparticle')]
private $shoparticleCrop;
#[ORM\OneToMany(targetEntity: 'App\Entity\CartItem', mappedBy: 'shoparticle')]
private $cartItem;
#[ORM\Column(type: 'decimal', precision: 10, scale: 2, nullable: true)]
private $cost;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $shop_url;
#[ORM\OneToMany(mappedBy: 'shoparticle', targetEntity: ShoparticleBlockentry::class, orphanRemoval: true)]
private Collection $shoparticleBlockentries;
public function __construct()
{
$this->shoparticleCrop = new ArrayCollection();
$this->cartItem = new ArrayCollection();
$this->shoparticleBlockentries = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getArticlenumber(): ?string
{
return $this->articlenumber;
}
public function setArticlenumber(?string $articlenumber): self
{
$this->articlenumber = $articlenumber;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): self
{
$this->price = $price;
return $this;
}
public function getStock(): ?int
{
return $this->stock;
}
public function setStock(?int $stock): self
{
$this->stock = $stock;
return $this;
}
public function getAvailable(): ?bool
{
return $this->available;
}
public function setAvailable(?bool $available): self
{
$this->available = $available;
return $this;
}
public function getImageUrl(): ?string
{
return $this->image_url;
}
public function setImageUrl(?string $image_url): self
{
$this->image_url = $image_url;
return $this;
}
public function getManufacturer(): ?string
{
return $this->manufacturer;
}
public function setManufacturer(?string $manufacturer): self
{
$this->manufacturer = $manufacturer;
return $this;
}
public function getDateCreated(): ?\DateTimeInterface
{
return $this->date_created;
}
public function setDateCreated(?\DateTimeInterface $date_created): self
{
$this->date_created = $date_created;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
/**
* @return Collection|ShoparticleCrop[]
*/
public function getShoparticleCrop(): Collection
{
return $this->shoparticleCrop;
}
public function addShoparticleCrop(ShoparticleCrop $shoparticleCrop): self
{
if (!$this->shoparticleCrop->contains($shoparticleCrop)) {
$this->shoparticleCrop[] = $shoparticleCrop;
$shoparticleCrop->setShoparticle($this);
}
return $this;
}
public function removeShoparticleCrop(ShoparticleCrop $shoparticleCrop): self
{
if ($this->shoparticleCrop->contains($shoparticleCrop)) {
$this->shoparticleCrop->removeElement($shoparticleCrop);
// set the owning side to null (unless already changed)
if ($shoparticleCrop->getShoparticle() === $this) {
$shoparticleCrop->setShoparticle(null);
}
}
return $this;
}
public function getPriority(): ?int
{
return $this->priority;
}
public function setPriority(?int $priority): self
{
$this->priority = $priority;
return $this;
}
public function getIsOrganic(): ?bool
{
return $this->is_organic;
}
public function setIsOrganic(?bool $is_organic): self
{
$this->is_organic = $is_organic;
return $this;
}
/**
* @return Collection|CartItem[]
*/
public function getCartItem(): Collection
{
return $this->cartItem;
}
public function addCartItem(CartItem $cartItem): self
{
if (!$this->cartItem->contains($cartItem)) {
$this->cartItem[] = $cartItem;
$cartItem->setShoparticle($this);
}
return $this;
}
public function removeCartItem(CartItem $cartItem): self
{
if ($this->cartItem->removeElement($cartItem)) {
// set the owning side to null (unless already changed)
if ($cartItem->getShoparticle() === $this) {
$cartItem->setShoparticle(null);
}
}
return $this;
}
public function getCost(): ?string
{
return $this->cost;
}
public function setCost(?string $cost): self
{
$this->cost = $cost;
return $this;
}
public function getShopUrl(): ?string
{
return $this->shop_url;
}
public function setShopUrl(?string $shop_url): self
{
$this->shop_url = $shop_url;
return $this;
}
/**
* @return Collection<int, ShoparticleBlockentry>
*/
public function getShoparticleBlockentries(): Collection
{
return $this->shoparticleBlockentries;
}
public function addShoparticleBlockentry(ShoparticleBlockentry $shoparticleBlockentry): static
{
if (!$this->shoparticleBlockentries->contains($shoparticleBlockentry)) {
$this->shoparticleBlockentries->add($shoparticleBlockentry);
$shoparticleBlockentry->setShoparticle($this);
}
return $this;
}
public function removeShoparticleBlockentry(ShoparticleBlockentry $shoparticleBlockentry): static
{
if ($this->shoparticleBlockentries->removeElement($shoparticleBlockentry)) {
// set the owning side to null (unless already changed)
if ($shoparticleBlockentry->getShoparticle() === $this) {
$shoparticleBlockentry->setShoparticle(null);
}
}
return $this;
}
}