collection-crud/src/Entity/CameraTrait.php

219 lines
4.0 KiB
PHP

<?php declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Trait CameraTrait
*
* Shared columns for camera, and previously_owned_camera tables
*
* @package App\Entity
*/
trait CameraTrait
{
use PurchasePriceTrait;
#[ORM\ManyToOne(targetEntity: 'CameraType')]
#[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: false)]
private readonly CameraType $type;
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: false)]
private readonly string $brand;
#[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: false)]
private readonly string $mount;
#[ORM\Column(name: 'model', type: 'string', length: 255, nullable: false)]
private readonly string $model;
#[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)]
private readonly bool $isDigital;
#[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: false)]
private string $cropFactor = '1.0';
#[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)]
private readonly bool $isWorking;
#[ORM\Column(name: 'notes', type: 'text', nullable: true)]
private readonly ?string $notes;
#[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: false)]
private readonly string $serial;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
private bool $formerlyOwned = FALSE;
#[ORM\Column(name: 'battery_type', type: 'string', nullable: true)]
private readonly ?string $batteryType;
#[ORM\Column(name: 'film_format', type: 'string', nullable: true)]
private ?string $filmFormat = '135';
#[ORM\Column(name: 'received', type: 'boolean', nullable: true)]
private ?bool $received = FALSE;
public function getId(): int
{
return $this->id;
}
public function setType(CameraType $type = null): self
{
$this->type = $type;
return $this;
}
public function getType(): CameraType
{
return $this->type;
}
public function setBrand(string $brand): self
{
$this->brand = $brand;
return $this;
}
public function getBrand(): string
{
return $this->brand;
}
public function setMount(string $mount): self
{
$this->mount = $mount;
return $this;
}
public function getMount(): string
{
return $this->mount;
}
public function setModel(string $model): self
{
$this->model = $model;
return $this;
}
public function getModel(): string
{
return $this->model;
}
public function setIsDigital(bool $isDigital): self
{
$this->isDigital = $isDigital;
return $this;
}
public function getIsDigital(): bool
{
return $this->isDigital;
}
public function setCropFactor(string $cropFactor): self
{
$this->cropFactor = $cropFactor;
return $this;
}
public function getCropFactor(): string
{
return $this->cropFactor;
}
public function setIsWorking(bool $isWorking): self
{
$this->isWorking = $isWorking;
return $this;
}
public function getIsWorking(): bool
{
return $this->isWorking;
}
public function setNotes(string $notes): self
{
$this->notes = $notes;
return $this;
}
public function getNotes(): string
{
return $this->notes ?? '';
}
public function setSerial(string $serial): self
{
$this->serial = $serial;
return $this;
}
public function getSerial(): string
{
return $this->serial ?? '';
}
public function setFormerlyOwned(bool $formerlyOwned): self
{
$this->formerlyOwned = $formerlyOwned;
return $this;
}
public function getFormerlyOwned(): bool
{
return $this->formerlyOwned;
}
public function setBatteryType(string $batteryType): self
{
$this->batteryType = $batteryType;
return $this;
}
public function getBatteryType(): string
{
return $this->batteryType ?? '';
}
public function setFilmFormat(string $filmFormat): self
{
$this->filmFormat = $filmFormat;
return $this;
}
public function getFilmFormat(): string
{
return $this->filmFormat ?? '';
}
public function setReceived(bool $received): self
{
$this->received = $received;
return $this;
}
public function getReceived(): bool
{
return $this->received;
}
}