Replace the last of the PHPDoc annotations with PHP attributes

This commit is contained in:
Timothy Warren 2022-02-17 15:48:16 -05:00
parent 372d348b16
commit 41caca2722
19 changed files with 96 additions and 309 deletions

View File

@ -24,7 +24,7 @@ doctrine:
mappings: mappings:
App: App:
is_bundle: false is_bundle: false
type: annotation type: attribute
dir: '%kernel.project_dir%/src/Entity' dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity' prefix: 'App\Entity'
alias: App alias: App

View File

@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use LogicException; use LogicException;
use App\Entity\Camera; use App\Entity\Camera;
use App\Form\CameraType; use App\Form\CameraType;
@ -22,13 +23,16 @@ class CameraController extends AbstractController
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Camera::class; protected const ENTITY = Camera::class;
protected const FORM = CameraType::class; protected const FORM = CameraType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all camera entities. * Lists all camera entities.
*/ */
#[Route(path: '/', name: 'camera_index', methods: ['GET'])] #[Route(path: '/', name: 'camera_index', methods: ['GET'])]
public function indexAction() : Response public function indexAction() : Response
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->managerRegistry->getManager();
$receivedItems = $em->getRepository(self::ENTITY)->findBy([ $receivedItems = $em->getRepository(self::ENTITY)->findBy([
'received' => true 'received' => true
], [ ], [
@ -91,11 +95,8 @@ class CameraController extends AbstractController
/** /**
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
* @param Request $request
* @param Camera $camera
* @throws LogicException * @throws LogicException
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
* @return RedirectResponse
*/ */
#[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])] #[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])]
public function deacquireAction(Request $request, Camera $camera) : RedirectResponse public function deacquireAction(Request $request, Camera $camera) : RedirectResponse
@ -117,8 +118,6 @@ class CameraController extends AbstractController
* Creates a form to move * Creates a form to move
* *
* @param Camera $camera The camera entity * @param Camera $camera The camera entity
*
* @return FormInterface
*/ */
private function createDeacquireForm(Camera $camera): FormInterface private function createDeacquireForm(Camera $camera): FormInterface
{ {

View File

@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use LogicException; use LogicException;
use App\Entity\Film; use App\Entity\Film;
use App\Form\FilmType; use App\Form\FilmType;
@ -21,13 +22,16 @@ class FilmController extends AbstractController
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Film::class; protected const ENTITY = Film::class;
protected const FORM = FilmType::class; protected const FORM = FilmType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all film entities. * Lists all film entities.
*/ */
#[Route(path: '/', name: 'film_index', methods: ['GET'])] #[Route(path: '/', name: 'film_index', methods: ['GET'])]
public function indexAction() : Response public function indexAction() : Response
{ {
$repo = $this->getDoctrine()->getManager()->getRepository(self::ENTITY); $repo = $this->managerRegistry->getManager()->getRepository(self::ENTITY);
$criteria = Criteria::create() $criteria = Criteria::create()
->where(Criteria::expr()->gt('rollsInCamera', 0)) ->where(Criteria::expr()->gt('rollsInCamera', 0))
->orderBy([ ->orderBy([

View File

@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use App\Entity\Lenses; use App\Entity\Lenses;
use App\Form\LensesType; use App\Form\LensesType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -18,13 +19,16 @@ class LensesController extends AbstractController
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Lenses::class; protected const ENTITY = Lenses::class;
protected const FORM = LensesType::class; protected const FORM = LensesType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
/** /**
* Lists all lens entities. * Lists all lens entities.
*/ */
#[Route(path: '/', name: 'lens_index', methods: ['GET'])] #[Route(path: '/', name: 'lens_index', methods: ['GET'])]
public function indexAction() public function indexAction()
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->managerRegistry->getManager();
$receivedItems = $em->getRepository(self::ENTITY)->findBy([ $receivedItems = $em->getRepository(self::ENTITY)->findBy([
'received' => true 'received' => true
], [ ], [
@ -76,7 +80,6 @@ class LensesController extends AbstractController
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
* @param Request $request * @param Request $request
* @param Lenses $lens
* @return RedirectResponse * @return RedirectResponse
*/ */
#[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])] #[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])]
@ -107,8 +110,6 @@ class LensesController extends AbstractController
* Creates a form to move * Creates a form to move
* *
* @param Lenses $lens The lens entity * @param Lenses $lens The lens entity
*
* @return FormInterface
*/ */
private function createDeacquireForm(Lenses $lens): FormInterface private function createDeacquireForm(Lenses $lens): FormInterface
{ {

View File

@ -57,7 +57,6 @@ class PreviouslyOwnedCameraController extends AbstractController
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* *
* @param Request $request * @param Request $request
* @param PreviouslyOwnedCamera $camera
* @throws LogicException * @throws LogicException
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
* @return RedirectResponse * @return RedirectResponse
@ -71,8 +70,6 @@ class PreviouslyOwnedCameraController extends AbstractController
* Creates a form to move * Creates a form to move
* *
* @param PreviouslyOwnedCamera $camera The camera entity * @param PreviouslyOwnedCamera $camera The camera entity
*
* @return FormInterface
*/ */
private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface
{ {

View File

@ -11,11 +11,8 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity] #[ORM\Entity]
class BatteryType class BatteryType
{ {
/**
* @var integer
*/
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id; private int $id;
} }

View File

@ -2,6 +2,7 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\CameraRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
@ -9,16 +10,13 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
#[ORM\Table(name: 'camera', schema: 'camera')] #[ORM\Table(name: 'camera', schema: 'camera')]
#[ORM\Index(columns: ['type_id'], name: 'IDX_747C826FC54C8C93')] #[ORM\Index(columns: ['type_id'], name: 'IDX_747C826FC54C8C93')]
#[ORM\Entity(repositoryClass: 'App\Repository\CameraRepository')] #[ORM\Entity(repositoryClass: CameraRepository::class)]
class Camera class Camera
{ {
use CameraTrait; use CameraTrait;
/**
* @var integer
*/
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)] #[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)]
private $id; private int $id;
} }

View File

@ -19,32 +19,27 @@ trait CameraTrait
* @var CameraType * @var CameraType
*/ */
#[ORM\ManyToOne(targetEntity: 'CameraType')] #[ORM\ManyToOne(targetEntity: 'CameraType')]
#[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id')] #[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id')]private readonly ?CameraType $type;
private ?CameraType $type;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: false)] #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: false)]private readonly string $brand;
private string $brand;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: false)] #[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: false)]private readonly string $mount;
private string $mount;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'model', type: 'string', length: 255, nullable: false)] #[ORM\Column(name: 'model', type: 'string', length: 255, nullable: false)]private readonly string $model;
private string $model;
/** /**
* @var boolean * @var boolean
*/ */
#[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)] #[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)]private readonly bool $isDigital;
private bool $isDigital;
/** /**
* @var string * @var string
@ -55,20 +50,17 @@ trait CameraTrait
/** /**
* @var boolean * @var boolean
*/ */
#[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)] #[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)]private readonly bool $isWorking;
private bool $isWorking;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'notes', type: 'text', nullable: true)] #[ORM\Column(name: 'notes', type: 'text', nullable: true)]private readonly ?string $notes;
private ?string $notes;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: false)] #[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: false)]private readonly string $serial;
private string $serial;
/** /**
* @var boolean * @var boolean
@ -85,8 +77,7 @@ trait CameraTrait
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'battery_type', type: 'string', nullable: true)] #[ORM\Column(name: 'battery_type', type: 'string', nullable: true)]private readonly ?string $batteryType;
private ?string $batteryType;
/** /**
* @var string * @var string
@ -102,8 +93,6 @@ trait CameraTrait
/** /**
* Get id * Get id
*
* @return integer
*/ */
public function getId(): int public function getId(): int
{ {
@ -113,9 +102,7 @@ trait CameraTrait
/** /**
* Set type * Set type
* *
* @param CameraType $type
* *
* @return self
*/ */
public function setType(CameraType $type = null): self public function setType(CameraType $type = null): self
{ {
@ -137,9 +124,7 @@ trait CameraTrait
/** /**
* Set brand * Set brand
* *
* @param string $brand
* *
* @return self
*/ */
public function setBrand(string $brand): self public function setBrand(string $brand): self
{ {
@ -161,9 +146,7 @@ trait CameraTrait
/** /**
* Set mount * Set mount
* *
* @param string $mount
* *
* @return self
*/ */
public function setMount(string $mount): self public function setMount(string $mount): self
{ {
@ -185,9 +168,7 @@ trait CameraTrait
/** /**
* Set model * Set model
* *
* @param string $model
* *
* @return self
*/ */
public function setModel(string $model): self public function setModel(string $model): self
{ {
@ -209,9 +190,7 @@ trait CameraTrait
/** /**
* Set isDigital * Set isDigital
* *
* @param boolean $isDigital
* *
* @return self
*/ */
public function setIsDigital(bool $isDigital): self public function setIsDigital(bool $isDigital): self
{ {
@ -233,9 +212,7 @@ trait CameraTrait
/** /**
* Set cropFactor * Set cropFactor
* *
* @param string $cropFactor
* *
* @return self
*/ */
public function setCropFactor(string $cropFactor): self public function setCropFactor(string $cropFactor): self
{ {
@ -246,8 +223,6 @@ trait CameraTrait
/** /**
* Get cropFactor * Get cropFactor
*
* @return string
*/ */
public function getCropFactor(): string public function getCropFactor(): string
{ {
@ -257,9 +232,7 @@ trait CameraTrait
/** /**
* Set isWorking * Set isWorking
* *
* @param boolean $isWorking
* *
* @return self
*/ */
public function setIsWorking(bool $isWorking): self public function setIsWorking(bool $isWorking): self
{ {
@ -282,8 +255,6 @@ trait CameraTrait
* Set notes * Set notes
* *
* @param string $notes * @param string $notes
*
* @return self
*/ */
public function setNotes($notes): self public function setNotes($notes): self
{ {
@ -294,8 +265,6 @@ trait CameraTrait
/** /**
* Get notes * Get notes
*
* @return string
*/ */
public function getNotes(): string public function getNotes(): string
{ {
@ -306,8 +275,6 @@ trait CameraTrait
* Set serial * Set serial
* *
* @param string $serial * @param string $serial
*
* @return self
*/ */
public function setSerial($serial): self public function setSerial($serial): self
{ {
@ -318,8 +285,6 @@ trait CameraTrait
/** /**
* Get serial * Get serial
*
* @return string
*/ */
public function getSerial(): string public function getSerial(): string
{ {
@ -330,8 +295,6 @@ trait CameraTrait
* Set formerlyOwned * Set formerlyOwned
* *
* @param boolean $formerlyOwned * @param boolean $formerlyOwned
*
* @return self
*/ */
public function setFormerlyOwned($formerlyOwned): self public function setFormerlyOwned($formerlyOwned): self
{ {
@ -354,8 +317,6 @@ trait CameraTrait
* Set batteryType * Set batteryType
* *
* @param string $batteryType * @param string $batteryType
*
* @return self
*/ */
public function setBatteryType($batteryType): self public function setBatteryType($batteryType): self
{ {
@ -378,8 +339,6 @@ trait CameraTrait
* Set filmFormat * Set filmFormat
* *
* @param string $filmFormat * @param string $filmFormat
*
* @return self
*/ */
public function setFilmFormat($filmFormat): self public function setFilmFormat($filmFormat): self
{ {
@ -390,8 +349,6 @@ trait CameraTrait
/** /**
* Get filmFormat * Get filmFormat
*
* @return string
*/ */
public function getFilmFormat(): string public function getFilmFormat(): string
{ {
@ -402,8 +359,6 @@ trait CameraTrait
* Set received * Set received
* *
* @param boolean $received * @param boolean $received
*
* @return self
*/ */
public function setReceived($received): self public function setReceived($received): self
{ {
@ -414,8 +369,6 @@ trait CameraTrait
/** /**
* Get received * Get received
*
* @return boolean
*/ */
public function getReceived(): bool public function getReceived(): bool
{ {

View File

@ -2,6 +2,7 @@
namespace App\Entity; namespace App\Entity;
use Stringable;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
@ -9,16 +10,13 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
#[ORM\Table(name: 'camera_type', schema: 'camera')] #[ORM\Table(name: 'camera_type', schema: 'camera')]
#[ORM\Entity] #[ORM\Entity]
class CameraType class CameraType implements Stringable
{ {
/**
* @var integer
*/
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)] #[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)]
private $id; private int $id;
/** /**
* @var string * @var string
*/ */
@ -28,11 +26,9 @@ class CameraType
* @var string * @var string
*/ */
#[ORM\Column(name: 'description', type: 'text', nullable: true)] #[ORM\Column(name: 'description', type: 'text', nullable: true)]
private ?string $description; private ?string $description = null;
/** /**
* Value for serialization * Value for serialization
*
* @return string
*/ */
public function __toString(): string public function __toString(): string
{ {
@ -40,8 +36,6 @@ class CameraType
} }
/** /**
* Get id * Get id
*
* @return integer
*/ */
public function getId(): int public function getId(): int
{ {
@ -50,9 +44,7 @@ class CameraType
/** /**
* Set type * Set type
* *
* @param string $type
* *
* @return CameraType
*/ */
public function setType(string $type): self public function setType(string $type): self
{ {
@ -63,9 +55,7 @@ class CameraType
/** /**
* Set description * Set description
* *
* @param string $description
* *
* @return CameraType
*/ */
public function setDescription(string $description): self public function setDescription(string $description): self
{ {

View File

@ -11,13 +11,10 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity] #[ORM\Entity]
class Film class Film
{ {
/**
* @var integer
*/
#[ORM\Id] #[ORM\Id]
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id; private int $id;
/** /**
* @var string * @var string
*/ */
@ -27,7 +24,7 @@ class Film
* @var string * @var string
*/ */
#[ORM\Column(name: 'product_line', type: 'string', nullable: true)] #[ORM\Column(name: 'product_line', type: 'string', nullable: true)]
private ?string $productLine; private ?string $productLine = null;
/** /**
* @var string * @var string
*/ */
@ -37,7 +34,7 @@ class Film
* @var string * @var string
*/ */
#[ORM\Column(name: 'film_alias', type: 'string', nullable: true)] #[ORM\Column(name: 'film_alias', type: 'string', nullable: true)]
private ?string $filmAlias; private ?string $filmAlias = null;
/** /**
* @var int * @var int
*/ */
@ -82,10 +79,7 @@ class Film
* @var string * @var string
*/ */
#[ORM\Column(name: 'notes', type: 'text', nullable: true)] #[ORM\Column(name: 'notes', type: 'text', nullable: true)]
private ?string $notes; private ?string $notes = null;
/**
* @return int
*/
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
@ -97,10 +91,6 @@ class Film
{ {
return $this->brand; return $this->brand;
} }
/**
* @param string $brand
* @return self
*/
public function setBrand(string $brand): self public function setBrand(string $brand): self
{ {
$this->brand = $brand; $this->brand = $brand;
@ -115,7 +105,6 @@ class Film
} }
/** /**
* @param string $productLine * @param string $productLine
* @return self
*/ */
public function setProductLine(?string $productLine): self public function setProductLine(?string $productLine): self
{ {
@ -129,10 +118,6 @@ class Film
{ {
return $this->filmName; return $this->filmName;
} }
/**
* @param string $filmName
* @return self
*/
public function setFilmName(string $filmName): self public function setFilmName(string $filmName): self
{ {
$this->filmName = $filmName; $this->filmName = $filmName;
@ -145,10 +130,6 @@ class Film
{ {
return $this->filmAlias; return $this->filmAlias;
} }
/**
* @param string $filmAlias
* @return self
*/
public function setFilmAlias(string $filmAlias): self public function setFilmAlias(string $filmAlias): self
{ {
$this->filmAlias = $filmAlias; $this->filmAlias = $filmAlias;
@ -161,10 +142,6 @@ class Film
{ {
return $this->filmSpeedAsa; return $this->filmSpeedAsa;
} }
/**
* @param int $filmSpeedAsa
* @return self
*/
public function setFilmSpeedAsa(int $filmSpeedAsa): self public function setFilmSpeedAsa(int $filmSpeedAsa): self
{ {
$this->filmSpeedAsa = $filmSpeedAsa; $this->filmSpeedAsa = $filmSpeedAsa;
@ -177,10 +154,6 @@ class Film
{ {
return $this->filmSpeedDin; return $this->filmSpeedDin;
} }
/**
* @param int $filmSpeedDin
* @return self
*/
public function setFilmSpeedDin(int $filmSpeedDin): self public function setFilmSpeedDin(int $filmSpeedDin): self
{ {
$this->filmSpeedDin = $filmSpeedDin; $this->filmSpeedDin = $filmSpeedDin;
@ -193,10 +166,6 @@ class Film
{ {
return $this->filmFormat; return $this->filmFormat;
} }
/**
* @param string $filmFormat
* @return self
*/
public function setFilmFormat(string $filmFormat): self public function setFilmFormat(string $filmFormat): self
{ {
$this->filmFormat = $filmFormat; $this->filmFormat = $filmFormat;
@ -209,10 +178,6 @@ class Film
{ {
return $this->filmBase; return $this->filmBase;
} }
/**
* @param string $filmBase
* @return self
*/
public function setFilmBase(string $filmBase): self public function setFilmBase(string $filmBase): self
{ {
$this->filmBase = $filmBase; $this->filmBase = $filmBase;
@ -225,10 +190,6 @@ class Film
{ {
return $this->unusedRolls; return $this->unusedRolls;
} }
/**
* @param int $unusedRolls
* @return self
*/
public function setUnusedRolls(int $unusedRolls): self public function setUnusedRolls(int $unusedRolls): self
{ {
$this->unusedRolls = $unusedRolls; $this->unusedRolls = $unusedRolls;
@ -241,10 +202,6 @@ class Film
{ {
return $this->rollsInCamera; return $this->rollsInCamera;
} }
/**
* @param int $rollsInCamera
* @return self
*/
public function setRollsInCamera(int $rollsInCamera): self public function setRollsInCamera(int $rollsInCamera): self
{ {
$this->rollsInCamera = $rollsInCamera; $this->rollsInCamera = $rollsInCamera;
@ -257,10 +214,6 @@ class Film
{ {
return $this->developedRolls; return $this->developedRolls;
} }
/**
* @param int $developedRolls
* @return self
*/
public function setDevelopedRolls(int $developedRolls): self public function setDevelopedRolls(int $developedRolls): self
{ {
$this->developedRolls = $developedRolls; $this->developedRolls = $developedRolls;
@ -273,10 +226,6 @@ class Film
{ {
return $this->chemistry; return $this->chemistry;
} }
/**
* @param string $chemistry
* @return self
*/
public function setChemistry(string $chemistry): self public function setChemistry(string $chemistry): self
{ {
$this->chemistry = $chemistry; $this->chemistry = $chemistry;
@ -289,10 +238,6 @@ class Film
{ {
return $this->notes; return $this->notes;
} }
/**
* @param string $notes
* @return self
*/
public function setNotes(string $notes): self public function setNotes(string $notes): self
{ {
$this->notes = $notes; $this->notes = $notes;

View File

@ -36,10 +36,6 @@ class FilmFormat
{ {
return $this->numberId; return $this->numberId;
} }
/**
* @param int $numberId
* @return self
*/
public function setNumberId(int $numberId): self public function setNumberId(int $numberId): self
{ {
$this->numberId = $numberId; $this->numberId = $numberId;
@ -52,10 +48,6 @@ class FilmFormat
{ {
return $this->name; return $this->name;
} }
/**
* @param string $name
* @return self
*/
public function setName(string $name): self public function setName(string $name): self
{ {
$this->name = $name; $this->name = $name;

View File

@ -11,14 +11,12 @@ trait FlashTrait
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'brand', type: 'string', nullable: false)] #[ORM\Column(name: 'brand', type: 'string', nullable: false)]private readonly string $brand;
private string $brand;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'model', type: 'string', nullable: false)] #[ORM\Column(name: 'model', type: 'string', nullable: false)]private readonly string $model;
private string $model;
/** /**
* @var boolean * @var boolean
@ -53,14 +51,12 @@ trait FlashTrait
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'guide_number', type: 'string', nullable: true)] #[ORM\Column(name: 'guide_number', type: 'string', nullable: true)]private readonly string $guideNumber;
private string $guideNumber;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)] #[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]private readonly ?string $purchasePrice;
private ?string $purchasePrice;
/** /**
* @var string * @var string
@ -71,19 +67,15 @@ trait FlashTrait
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'notes', type: 'text', nullable: true)] #[ORM\Column(name: 'notes', type: 'text', nullable: true)]private readonly ?string $notes;
private ?string $notes;
/** /**
* @var string * @var string
*/ */
#[ORM\Column(name: 'serial', type: 'string', nullable: true)] #[ORM\Column(name: 'serial', type: 'string', nullable: true)]private readonly ?string $serial;
private ?string $serial;
/** /**
* Get id * Get id
*
* @return integer
*/ */
public function getId(): int public function getId(): int
{ {
@ -238,8 +230,6 @@ trait FlashTrait
* Set pTtlType * Set pTtlType
* *
* @param string $pTtlType * @param string $pTtlType
*
* @return self
*/ */
public function setPTtlType($pTtlType): self public function setPTtlType($pTtlType): self
{ {

View File

@ -2,148 +2,129 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
trait LensTrait trait LensTrait
{ {
use PurchasePriceTrait; use PurchasePriceTrait;
/** /**
* @var string * @var string
*
* @ORM\Column(name="brand", type="string", length=64, nullable=true)
*/ */
private ?string $brand; #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: true)]
private readonly ?string $brand;
/** /**
* @var string * @var string
*
* @ORM\Column(name="coatings", type="string", length=64, nullable=true)
*/ */
private ?string $coatings; #[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: true)]
private readonly ?string $coatings;
/** /**
* @var string * @var string
*
* @ORM\Column(name="product_line", type="string", length=64, nullable=true)
*/ */
private ?string $productLine; #[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: true)]
private readonly ?string $productLine;
/** /**
* @var string * @var string
*
* @ORM\Column(name="model", type="string", length=64, nullable=true)
*/ */
private ?string $model; #[ORM\Column(name: 'model', type: 'string', length: 64, nullable: true)]
private readonly ?string $model;
/** /**
* @var string * @var string
*
* @ORM\Column(name="min_f_stop", type="string", length=10, nullable=true)
*/ */
private ?string $minFStop; #[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: true)]
private readonly ?string $minFStop;
/** /**
* @var float * @var float
*
* @ORM\Column(name="max_f_stop", type="float", precision=10, scale=0, nullable=true)
*/ */
private ?float $maxFStop; #[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: true)]
private readonly ?float $maxFStop;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="min_focal_length", type="integer", nullable=true)
*/ */
private ?int $minFocalLength; #[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: true)]
private readonly ?int $minFocalLength;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="max_focal_length", type="integer", nullable=true)
*/ */
private ?int $maxFocalLength; #[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: true)]
private readonly ?int $maxFocalLength;
/** /**
* @var string * @var string
*
* @ORM\Column(name="serial", type="string", length=10, nullable=true)
*/ */
private ?string $serial; #[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: true)]
private readonly ?string $serial;
/** /**
* @var string * @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/ */
private ?string $purchasePrice; #[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]
private readonly ?string $purchasePrice;
/** /**
* @var string * @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/ */
private ?string $notes; #[ORM\Column(name: 'notes', type: 'text', nullable: true)]
private readonly ?string $notes;
/** /**
* @var string * @var string
*
* @ORM\Column(name="image_size", type="string", nullable=false, options={"default"="35mm"})
*/ */
#[ORM\Column(name: 'image_size', type: 'string', nullable: false, options: ['default' => '35mm'])]
private string $imageSize = '35mm'; private string $imageSize = '35mm';
/** /**
* @var string * @var string
*
* @ORM\Column(name="mount", type="string", length=40, nullable=true)
*/ */
private ?string $mount; #[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: true)]
private readonly ?string $mount;
/** /**
* @var string * @var string
*
* @ORM\Column(name="front_filter_size", type="decimal", precision=10, scale=0, nullable=true)
*/ */
private ?string $frontFilterSize; #[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)]
private readonly ?string $frontFilterSize;
/** /**
* @var string * @var string
*
* @ORM\Column(name="rear_filter_size", type="decimal", precision=10, scale=0, nullable=true)
*/ */
private? string $rearFilterSize; #[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)]
private readonly ? string $rearFilterSize;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="is_teleconverter", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: false)]
private bool $isTeleconverter = false; private bool $isTeleconverter = false;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="design_elements", type="smallint", nullable=true)
*/ */
private ?int $designElements; #[ORM\Column(name: 'design_elements', type: 'smallint', nullable: true)]
private readonly ?int $designElements;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="design_groups", type="smallint", nullable=true)
*/ */
private ?int $designGroups; #[ORM\Column(name: 'design_groups', type: 'smallint', nullable: true)]
private readonly ?int $designGroups;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="aperture_blades", type="smallint", nullable=true)
*/ */
private ?int $apertureBlades; #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: true)]
private readonly ?int $apertureBlades;
/** /**
* Get id * Get id
*
* @return integer
*/ */
public function getId(): int public function getId(): int
{ {
@ -154,8 +135,6 @@ trait LensTrait
* Set brand * Set brand
* *
* @param string $brand * @param string $brand
*
* @return self
*/ */
public function setBrand($brand): self public function setBrand($brand): self
{ {
@ -178,8 +157,6 @@ trait LensTrait
* Set coatings * Set coatings
* *
* @param string $coatings * @param string $coatings
*
* @return self
*/ */
public function setCoatings($coatings): self public function setCoatings($coatings): self
{ {
@ -202,8 +179,6 @@ trait LensTrait
* Set productLine * Set productLine
* *
* @param string $productLine * @param string $productLine
*
* @return self
*/ */
public function setProductLine($productLine): self public function setProductLine($productLine): self
{ {
@ -226,8 +201,6 @@ trait LensTrait
* Set model * Set model
* *
* @param string $model * @param string $model
*
* @return self
*/ */
public function setModel($model): self public function setModel($model): self
{ {
@ -250,8 +223,6 @@ trait LensTrait
* Set minFStop * Set minFStop
* *
* @param string $minFStop * @param string $minFStop
*
* @return self
*/ */
public function setMinFStop($minFStop): self public function setMinFStop($minFStop): self
{ {
@ -274,8 +245,6 @@ trait LensTrait
* Set maxFStop * Set maxFStop
* *
* @param float $maxFStop * @param float $maxFStop
*
* @return self
*/ */
public function setMaxFStop($maxFStop): self public function setMaxFStop($maxFStop): self
{ {
@ -298,8 +267,6 @@ trait LensTrait
* Set minFocalLength * Set minFocalLength
* *
* @param integer $minFocalLength * @param integer $minFocalLength
*
* @return self
*/ */
public function setMinFocalLength($minFocalLength): self public function setMinFocalLength($minFocalLength): self
{ {
@ -322,8 +289,6 @@ trait LensTrait
* Set maxFocalLength * Set maxFocalLength
* *
* @param integer $maxFocalLength * @param integer $maxFocalLength
*
* @return self
*/ */
public function setMaxFocalLength($maxFocalLength): self public function setMaxFocalLength($maxFocalLength): self
{ {
@ -346,8 +311,6 @@ trait LensTrait
* Set serial * Set serial
* *
* @param string $serial * @param string $serial
*
* @return self
*/ */
public function setSerial($serial): self public function setSerial($serial): self
{ {
@ -358,8 +321,6 @@ trait LensTrait
/** /**
* Get serial * Get serial
*
* @return string
*/ */
public function getSerial(): string public function getSerial(): string
{ {
@ -370,8 +331,6 @@ trait LensTrait
* Set notes * Set notes
* *
* @param string $notes * @param string $notes
*
* @return self
*/ */
public function setNotes(?string $notes): self public function setNotes(?string $notes): self
{ {
@ -382,8 +341,6 @@ trait LensTrait
/** /**
* Get notes * Get notes
*
* @return string
*/ */
public function getNotes(): string public function getNotes(): string
{ {
@ -392,8 +349,6 @@ trait LensTrait
/** /**
* Get image size * Get image size
*
* @return string
*/ */
public function getImageSize(): string public function getImageSize(): string
{ {
@ -402,9 +357,6 @@ trait LensTrait
/** /**
* Set image size * Set image size
*
* @param string $imageSize
* @return self
*/ */
public function setImageSize(string $imageSize): self public function setImageSize(string $imageSize): self
{ {
@ -416,8 +368,6 @@ trait LensTrait
* Set mount * Set mount
* *
* @param string $mount * @param string $mount
*
* @return self
*/ */
public function setMount($mount): self public function setMount($mount): self
{ {
@ -440,8 +390,6 @@ trait LensTrait
* Set received * Set received
* *
* @param boolean $received * @param boolean $received
*
* @return self
*/ */
public function setReceived($received): self public function setReceived($received): self
{ {
@ -464,8 +412,6 @@ trait LensTrait
* Set formerlyOwned * Set formerlyOwned
* *
* @param boolean $formerlyOwned * @param boolean $formerlyOwned
*
* @return self
*/ */
public function setFormerlyOwned($formerlyOwned): self public function setFormerlyOwned($formerlyOwned): self
{ {
@ -488,8 +434,6 @@ trait LensTrait
* Set frontFilterSize * Set frontFilterSize
* *
* @param string $frontFilterSize * @param string $frontFilterSize
*
* @return self
*/ */
public function setFrontFilterSize($frontFilterSize): self public function setFrontFilterSize($frontFilterSize): self
{ {
@ -512,8 +456,6 @@ trait LensTrait
* Set rearFilterSize * Set rearFilterSize
* *
* @param string $rearFilterSize * @param string $rearFilterSize
*
* @return self
*/ */
public function setRearFilterSize($rearFilterSize): self public function setRearFilterSize($rearFilterSize): self
{ {
@ -536,8 +478,6 @@ trait LensTrait
* Set isTeleconverter * Set isTeleconverter
* *
* @param boolean $isTeleconverter * @param boolean $isTeleconverter
*
* @return self
*/ */
public function setIsTeleconverter($isTeleconverter): self public function setIsTeleconverter($isTeleconverter): self
{ {
@ -560,8 +500,6 @@ trait LensTrait
* Set designElements * Set designElements
* *
* @param integer $designElements * @param integer $designElements
*
* @return self
*/ */
public function setDesignElements($designElements): self public function setDesignElements($designElements): self
{ {
@ -584,8 +522,6 @@ trait LensTrait
* Set designGroups * Set designGroups
* *
* @param integer $designGroups * @param integer $designGroups
*
* @return self
*/ */
public function setDesignGroups($designGroups): self public function setDesignGroups($designGroups): self
{ {
@ -608,8 +544,6 @@ trait LensTrait
* Set apertureBlades * Set apertureBlades
* *
* @param integer $apertureBlades * @param integer $apertureBlades
*
* @return self
*/ */
public function setApertureBlades($apertureBlades): self public function setApertureBlades($apertureBlades): self
{ {

View File

@ -2,32 +2,24 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\LensesRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.lenses * Camera.lenses
*/ */
#[ORM\Table(name: 'lenses', schema: 'camera')] #[ORM\Table(name: 'lenses', schema: 'camera')]
#[ORM\Entity(repositoryClass: 'App\Repository\LensesRepository')] #[ORM\Entity(repositoryClass: LensesRepository::class)]
class Lenses class Lenses
{ {
use LensTrait; use LensTrait;
/**
* @var integer
*/
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)] #[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)]
private $id; private int $id;
/**
* @var boolean
*/
#[ORM\Column(name: 'received', type: 'boolean', nullable: false)] #[ORM\Column(name: 'received', type: 'boolean', nullable: false)]
private $received = false; private bool $received = false;
/**
* @var boolean
*/
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
private $formerlyOwned = false; private bool $formerlyOwned = false;
} }

View File

@ -2,6 +2,7 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\CameraRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
@ -9,16 +10,13 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
#[ORM\Table(name: 'previously_owned_camera', schema: 'camera')] #[ORM\Table(name: 'previously_owned_camera', schema: 'camera')]
#[ORM\Index(name: 'IDX_6EF94C6BC54C8C93', columns: ['type_id'])] #[ORM\Index(name: 'IDX_6EF94C6BC54C8C93', columns: ['type_id'])]
#[ORM\Entity(repositoryClass: 'App\Repository\CameraRepository')] #[ORM\Entity(repositoryClass: CameraRepository::class)]
class PreviouslyOwnedCamera class PreviouslyOwnedCamera
{ {
use CameraTrait; use CameraTrait;
/**
* @var integer
*/
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)] #[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)]
private $id; private int $id;
} }

View File

@ -2,23 +2,21 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\LensesRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.previouslyOwnedLenses * Camera.previouslyOwnedLenses
*/ */
#[ORM\Table(name: 'previously_owned_lenses', schema: 'camera')] #[ORM\Table(name: 'previously_owned_lenses', schema: 'camera')]
#[ORM\Entity(repositoryClass: 'App\Repository\LensesRepository')] #[ORM\Entity(repositoryClass: LensesRepository::class)]
class PreviouslyOwnedLenses class PreviouslyOwnedLenses
{ {
use LensTrait; use LensTrait;
/**
* @var integer
*/
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id; private int $id;
/** /**
* @var boolean * @var boolean
*/ */

View File

@ -8,8 +8,6 @@ trait PurchasePriceTrait
* Set purchasePrice * Set purchasePrice
* *
* @param string $purchasePrice * @param string $purchasePrice
*
* @return self
*/ */
public function setPurchasePrice($purchasePrice): self public function setPurchasePrice($purchasePrice): self
{ {

View File

@ -36,7 +36,7 @@ trait AcquireTrait {
$em->remove($currentRecord); $em->remove($currentRecord);
$em->flush(); $em->flush();
} }
catch (Throwable $e) catch (Throwable)
{ {
dump($newRecord); dump($newRecord);
} }

View File

@ -2,8 +2,9 @@
namespace App\ValueObject; namespace App\ValueObject;
class Money { use Stringable;
private float $value; class Money implements Stringable {
private readonly float $value;
public function __construct($value) public function __construct($value)
{ {