Convert Doctrine PHPDoc annotations to PHP attributes

This commit is contained in:
Timothy Warren 2022-02-17 15:10:57 -05:00
parent 426d30ebc0
commit dbfe26e27b
18 changed files with 136 additions and 273 deletions

View File

@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use LogicException;
use App\Entity\Camera; use App\Entity\Camera;
use App\Form\CameraType; use App\Form\CameraType;
use Doctrine\ORM\ORMInvalidArgumentException; use Doctrine\ORM\ORMInvalidArgumentException;
@ -83,7 +84,7 @@ class CameraController extends AbstractController
* Displays a form to edit an existing camera entity. * Displays a form to edit an existing camera entity.
* *
* @Route("/{id}/edit", name="camera_edit", methods={"GET", "POST"}) * @Route("/{id}/edit", name="camera_edit", methods={"GET", "POST"})
* @throws \LogicException * @throws LogicException
*/ */
public function editAction(Request $request, Camera $camera) public function editAction(Request $request, Camera $camera)
{ {
@ -94,7 +95,7 @@ class CameraController extends AbstractController
* Deletes a camera entity. * Deletes a camera entity.
* *
* @Route("/{id}", name="camera_delete", methods={"DELETE"}) * @Route("/{id}", name="camera_delete", methods={"DELETE"})
* @throws \LogicException * @throws LogicException
*/ */
public function deleteAction(Request $request, Camera $camera): RedirectResponse public function deleteAction(Request $request, Camera $camera): RedirectResponse
{ {
@ -107,7 +108,7 @@ class CameraController extends AbstractController
* @Route("/{id}/deacquire", name="camera_deacquire", methods={"POST"}) * @Route("/{id}/deacquire", name="camera_deacquire", methods={"POST"})
* @param Request $request * @param Request $request
* @param Camera $camera * @param Camera $camera
* @throws \LogicException * @throws LogicException
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
* @return RedirectResponse * @return RedirectResponse
*/ */

View File

@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use Symfony\Component\Form\Form;
use App\Entity\CameraType; use App\Entity\CameraType;
use App\Form\CameraTypeType; use App\Form\CameraTypeType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -77,7 +78,7 @@ class CameraTypeController extends AbstractController
* *
* @param CameraType $cameraType The cameraType entity * @param CameraType $cameraType The cameraType entity
* *
* @return \Symfony\Component\Form\Form The form * @return Form The form
*/ */
private function createDeleteForm(CameraType $cameraType) private function createDeleteForm(CameraType $cameraType)
{ {

View File

@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use LogicException;
use App\Entity\Film; use App\Entity\Film;
use App\Form\FilmType; use App\Form\FilmType;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
@ -82,7 +83,7 @@ class FilmController extends AbstractController
* Displays a form to edit an existing film entity. * Displays a form to edit an existing film entity.
* *
* @Route("/{id}/edit", name="film_edit", methods={"GET", "POST"}) * @Route("/{id}/edit", name="film_edit", methods={"GET", "POST"})
* @throws \LogicException * @throws LogicException
*/ */
public function editAction(Request $request, Film $film) public function editAction(Request $request, Film $film)
{ {
@ -93,7 +94,7 @@ class FilmController extends AbstractController
* Deletes a film entity. * Deletes a film entity.
* *
* @Route("/{id}", name="film_delete", methods={"DELETE"}) * @Route("/{id}", name="film_delete", methods={"DELETE"})
* @throws \LogicException * @throws LogicException
*/ */
public function deleteAction(Request $request, Film $film) public function deleteAction(Request $request, Film $film)
{ {

View File

@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use Symfony\Component\Form\FormInterface;
use App\Entity\Flash; use App\Entity\Flash;
use App\Form\FlashType; use App\Form\FlashType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -75,7 +76,7 @@ class FlashController extends AbstractController
* *
* @param Flash $flash The flash entity * @param Flash $flash The flash entity
* *
* @return \Symfony\Component\Form\FormInterface The form * @return FormInterface The form
*/ */
private function createDeleteForm(Flash $flash) private function createDeleteForm(Flash $flash)
{ {

View File

@ -2,6 +2,9 @@
namespace App\Controller; namespace App\Controller;
use UnexpectedValueException;
use LogicException;
use Doctrine\ORM\ORMInvalidArgumentException;
use App\Entity\PreviouslyOwnedCamera; use App\Entity\PreviouslyOwnedCamera;
use App\Form\PreviouslyOwnedCameraType; use App\Form\PreviouslyOwnedCameraType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -25,7 +28,7 @@ class PreviouslyOwnedCameraController extends AbstractController
* Lists all previouslyOwnedCamera entities. * Lists all previouslyOwnedCamera entities.
* *
* @Route("/", name="previously-owned-camera_index", methods={"GET"}) * @Route("/", name="previously-owned-camera_index", methods={"GET"})
* @throws \UnexpectedValueException * @throws UnexpectedValueException
*/ */
public function indexAction() public function indexAction()
{ {
@ -50,7 +53,7 @@ class PreviouslyOwnedCameraController extends AbstractController
* Displays a form to edit an existing previouslyOwnedCamera entity. * Displays a form to edit an existing previouslyOwnedCamera entity.
* *
* @Route("/{id}/edit", name="previously-owned-camera_edit", methods={"GET", "POST"}) * @Route("/{id}/edit", name="previously-owned-camera_edit", methods={"GET", "POST"})
* @throws \LogicException * @throws LogicException
*/ */
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera) public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera)
{ {
@ -63,8 +66,8 @@ class PreviouslyOwnedCameraController extends AbstractController
* @Route("/{id}/reacquire", name="previously-owned-camera_reacquire", methods={"POST"}) * @Route("/{id}/reacquire", name="previously-owned-camera_reacquire", methods={"POST"})
* @param Request $request * @param Request $request
* @param PreviouslyOwnedCamera $camera * @param PreviouslyOwnedCamera $camera
* @throws \LogicException * @throws LogicException
* @throws \Doctrine\ORM\ORMInvalidArgumentException * @throws ORMInvalidArgumentException
* @return RedirectResponse * @return RedirectResponse
*/ */
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse

View File

@ -6,18 +6,16 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Battery Type * Battery Type
*
* @ORM\Table(name="battery_type", schema="camera")
* @ORM\Entity
*/ */
#[ORM\Table(name: 'battery_type', schema: 'camera')]
#[ORM\Entity]
class BatteryType class BatteryType
{ {
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/ */
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id; private $id;
} }

View File

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

View File

@ -17,103 +17,87 @@ trait CameraTrait
/** /**
* @var CameraType * @var CameraType
*
* @ORM\ManyToOne(targetEntity="CameraType")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
* })
*/ */
#[ORM\ManyToOne(targetEntity: 'CameraType')]
#[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id')]
private ?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 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 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 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 bool $isDigital; private bool $isDigital;
/** /**
* @var string * @var string
*
* @ORM\Column(name="crop_factor", type="decimal", precision=10, scale=0, nullable=false)
*/ */
#[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: false)]
private string $cropFactor = '1.0'; private string $cropFactor = '1.0';
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="is_working", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)]
private 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 ?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 string $serial; private string $serial;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
private bool $formerlyOwned = FALSE; private bool $formerlyOwned = FALSE;
/** /**
* @var string * @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/ */
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]
private $purchasePrice; private $purchasePrice;
/** /**
* @var string * @var string
*
* @ORM\Column(name="battery_type", type="string", nullable=true)
*/ */
#[ORM\Column(name: 'battery_type', type: 'string', nullable: true)]
private ?string $batteryType; private ?string $batteryType;
/** /**
* @var string * @var string
*
* @ORM\Column(name="film_format", type="string", nullable=true)
*/ */
#[ORM\Column(name: 'film_format', type: 'string', nullable: true)]
private ?string $filmFormat = '135'; private ?string $filmFormat = '135';
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=true)
*/ */
#[ORM\Column(name: 'received', type: 'boolean', nullable: true)]
private ?bool $received = FALSE; private ?bool $received = FALSE;
/** /**

View File

@ -6,37 +6,29 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* CameraType * CameraType
*
* @ORM\Table(name="camera_type", schema="camera")
* @ORM\Entity
*/ */
#[ORM\Table(name: 'camera_type', schema: 'camera')]
#[ORM\Entity]
class CameraType class CameraType
{ {
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\SequenceGenerator(sequenceName="camera.camera_type_id_seq", allocationSize=1, initialValue=1)
*/ */
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)]
private $id; private $id;
/** /**
* @var string * @var string
*
* @ORM\Column(name="type", type="string", length=255, nullable=false)
*/ */
#[ORM\Column(name: 'type', type: 'string', length: 255, nullable: false)]
private string $type; private string $type;
/** /**
* @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;
/** /**
* Value for serialization * Value for serialization
* *
@ -46,8 +38,6 @@ class CameraType
{ {
return $this->type; return $this->type;
} }
/** /**
* Get id * Get id
* *
@ -57,7 +47,6 @@ class CameraType
{ {
return $this->id; return $this->id;
} }
/** /**
* Set type * Set type
* *
@ -71,7 +60,6 @@ class CameraType
return $this; return $this;
} }
/** /**
* Set description * Set description
* *
@ -85,7 +73,6 @@ class CameraType
return $this; return $this;
} }
/** /**
* Get type * Get type
* *
@ -95,7 +82,6 @@ class CameraType
{ {
return $this->type; return $this->type;
} }
/** /**
* Get description * Get description
* *

View File

@ -6,112 +6,83 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera * Camera
*
* @ORM\Table(name="film", schema="camera")
* @ORM\Entity
*/ */
class Film { #[ORM\Table(name: 'film', schema: 'camera')]
#[ORM\Entity]
class Film
{
/** /**
* @var integer * @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\GeneratedValue(strategy="IDENTITY")
*/ */
#[ORM\Id]
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id; private $id;
/** /**
* @var string * @var string
*
* @ORM\Column(name="brand", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'brand', type: 'string', nullable: false)]
private string $brand; private string $brand;
/** /**
* @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;
/** /**
* @var string * @var string
*
* @ORM\Column(name="film_name", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'film_name', type: 'string', nullable: false)]
private string $filmName; private string $filmName;
/** /**
* @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;
/** /**
* @var int * @var int
*
* @ORM\Column(name="film_speed_asa", type="integer", nullable=false)
*/ */
#[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: false)]
private int $filmSpeedAsa; private int $filmSpeedAsa;
/** /**
* @var int * @var int
*
* @ORM\Column(name="film_speed_din", type="integer", nullable=false)
*/ */
#[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: false)]
private int $filmSpeedDin; private int $filmSpeedDin;
/** /**
* @var string * @var string
*
* @ORM\Column(name="film_format", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'film_format', type: 'string', nullable: false)]
private string $filmFormat; private string $filmFormat;
/** /**
* @var string * @var string
*
* @ORM\Column(name="film_base", type="string", nullable=false, options={"default"="Cellulose Triacetate"})
*/ */
#[ORM\Column(name: 'film_base', type: 'string', nullable: false, options: ['default' => 'Cellulose Triacetate'])]
private string $filmBase = 'Cellulose Triacetate'; private string $filmBase = 'Cellulose Triacetate';
/** /**
* @var int * @var int
*
* @ORM\Column(name="unused_rolls", type="integer", nullable=false, options={"default"=0})
*/ */
#[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: false, options: ['default' => 0])]
private int $unusedRolls = 0; private int $unusedRolls = 0;
/** /**
* @var int * @var int
*
* @ORM\Column(name="rolls_in_camera", type="integer", nullable=false, options={"default"=0})
*/ */
#[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: false, options: ['default' => 0])]
private int $rollsInCamera = 0; private int $rollsInCamera = 0;
/** /**
* @var int * @var int
*
* @ORM\Column(name="developed_rolls", type="integer", nullable=false, options={"default"=0})
*/ */
#[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: false, options: ['default' => 0])]
private int $developedRolls = 0; private int $developedRolls = 0;
/** /**
* @var string * @var string
*
* @ORM\Column(name="chemistry", type="string", nullable=false, options={"default"="C-41"})
*/ */
#[ORM\Column(name: 'chemistry', type: 'string', nullable: false, options: ['default' => 'C-41'])]
private string $chemistry = 'C-41'; private string $chemistry = 'C-41';
/** /**
* @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;
/** /**
* @return int * @return int
*/ */
@ -119,7 +90,6 @@ class Film {
{ {
return $this->id; return $this->id;
} }
/** /**
* @return string * @return string
*/ */
@ -127,7 +97,6 @@ class Film {
{ {
return $this->brand; return $this->brand;
} }
/** /**
* @param string $brand * @param string $brand
* @return self * @return self
@ -137,7 +106,6 @@ class Film {
$this->brand = $brand; $this->brand = $brand;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -145,7 +113,6 @@ class Film {
{ {
return $this->productLine; return $this->productLine;
} }
/** /**
* @param string $productLine * @param string $productLine
* @return self * @return self
@ -155,7 +122,6 @@ class Film {
$this->productLine = $productLine; $this->productLine = $productLine;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -163,7 +129,6 @@ class Film {
{ {
return $this->filmName; return $this->filmName;
} }
/** /**
* @param string $filmName * @param string $filmName
* @return self * @return self
@ -173,7 +138,6 @@ class Film {
$this->filmName = $filmName; $this->filmName = $filmName;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -181,7 +145,6 @@ class Film {
{ {
return $this->filmAlias; return $this->filmAlias;
} }
/** /**
* @param string $filmAlias * @param string $filmAlias
* @return self * @return self
@ -191,7 +154,6 @@ class Film {
$this->filmAlias = $filmAlias; $this->filmAlias = $filmAlias;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -199,7 +161,6 @@ class Film {
{ {
return $this->filmSpeedAsa; return $this->filmSpeedAsa;
} }
/** /**
* @param int $filmSpeedAsa * @param int $filmSpeedAsa
* @return self * @return self
@ -209,7 +170,6 @@ class Film {
$this->filmSpeedAsa = $filmSpeedAsa; $this->filmSpeedAsa = $filmSpeedAsa;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -217,7 +177,6 @@ class Film {
{ {
return $this->filmSpeedDin; return $this->filmSpeedDin;
} }
/** /**
* @param int $filmSpeedDin * @param int $filmSpeedDin
* @return self * @return self
@ -227,7 +186,6 @@ class Film {
$this->filmSpeedDin = $filmSpeedDin; $this->filmSpeedDin = $filmSpeedDin;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -235,7 +193,6 @@ class Film {
{ {
return $this->filmFormat; return $this->filmFormat;
} }
/** /**
* @param string $filmFormat * @param string $filmFormat
* @return self * @return self
@ -245,7 +202,6 @@ class Film {
$this->filmFormat = $filmFormat; $this->filmFormat = $filmFormat;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -253,7 +209,6 @@ class Film {
{ {
return $this->filmBase; return $this->filmBase;
} }
/** /**
* @param string $filmBase * @param string $filmBase
* @return self * @return self
@ -263,7 +218,6 @@ class Film {
$this->filmBase = $filmBase; $this->filmBase = $filmBase;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -271,7 +225,6 @@ class Film {
{ {
return $this->unusedRolls; return $this->unusedRolls;
} }
/** /**
* @param int $unusedRolls * @param int $unusedRolls
* @return self * @return self
@ -281,7 +234,6 @@ class Film {
$this->unusedRolls = $unusedRolls; $this->unusedRolls = $unusedRolls;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -289,7 +241,6 @@ class Film {
{ {
return $this->rollsInCamera; return $this->rollsInCamera;
} }
/** /**
* @param int $rollsInCamera * @param int $rollsInCamera
* @return self * @return self
@ -299,7 +250,6 @@ class Film {
$this->rollsInCamera = $rollsInCamera; $this->rollsInCamera = $rollsInCamera;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
@ -307,7 +257,6 @@ class Film {
{ {
return $this->developedRolls; return $this->developedRolls;
} }
/** /**
* @param int $developedRolls * @param int $developedRolls
* @return self * @return self
@ -317,7 +266,6 @@ class Film {
$this->developedRolls = $developedRolls; $this->developedRolls = $developedRolls;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -325,7 +273,6 @@ class Film {
{ {
return $this->chemistry; return $this->chemistry;
} }
/** /**
* @param string $chemistry * @param string $chemistry
* @return self * @return self
@ -335,7 +282,6 @@ class Film {
$this->chemistry = $chemistry; $this->chemistry = $chemistry;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -343,7 +289,6 @@ class Film {
{ {
return $this->notes; return $this->notes;
} }
/** /**
* @param string $notes * @param string $notes
* @return self * @return self

View File

@ -4,33 +4,24 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** #[ORM\Table(name: 'film_format', schema: 'camera')]
* @ORM\Table(name="film_format", schema="camera") #[ORM\Entity]
* @ORM\Entity
*/
class FilmFormat class FilmFormat
{ {
/** #[ORM\Id]
* @ORM\Id #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: 'integer')]
* @ORM\Column(type="integer")
*/
private int $id; private int $id;
/** /**
* @var int * @var int
*
* @ORM\Column(name="number_id", type="integer")
*/ */
#[ORM\Column(name: 'number_id', type: 'integer')]
private int $numberId; private int $numberId;
/** /**
* @var string * @var string
*
* @ORM\Column(name="name", type="string")
*/ */
#[ORM\Column(name: 'name', type: 'string')]
private string $name; private string $name;
/** /**
* @return int * @return int
*/ */
@ -38,7 +29,6 @@ class FilmFormat
{ {
return $this->id; return $this->id;
} }
/** /**
* @return int * @return int
*/ */
@ -46,7 +36,6 @@ class FilmFormat
{ {
return $this->numberId; return $this->numberId;
} }
/** /**
* @param int $numberId * @param int $numberId
* @return self * @return self
@ -56,7 +45,6 @@ class FilmFormat
$this->numberId = $numberId; $this->numberId = $numberId;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
@ -64,7 +52,6 @@ class FilmFormat
{ {
return $this->name; return $this->name;
} }
/** /**
* @param string $name * @param string $name
* @return self * @return self

View File

@ -6,36 +6,28 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.flash * Camera.flash
*
* @ORM\Table(name="flash", schema="camera")
* @ORM\Entity
*/ */
#[ORM\Table(name: 'flash', schema: 'camera')]
#[ORM\Entity]
class Flash class Flash
{ {
use FlashTrait; use FlashTrait;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\SequenceGenerator(sequenceName="camera.flash_id_seq", allocationSize=1, initialValue=1)
*/ */
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)]
private $id; private $id;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false, options={"default" : false})
*/ */
#[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $received = false; private bool $received = false;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false, options={"default" : false})
*/ */
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $formerlyOwned = false; private bool $formerlyOwned = false;
} }

View File

@ -10,86 +10,74 @@ trait FlashTrait
/** /**
* @var string * @var string
*
* @ORM\Column(name="brand", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'brand', type: 'string', nullable: false)]
private 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 string $model; private string $model;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="is_auto_flash", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: false)]
private bool $isAutoFlash = false; private bool $isAutoFlash = false;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="is_ttl", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: false)]
private bool $isTtl = false; private bool $isTtl = false;
/** /**
* @var string * @var string
*
* @ORM\Column(name="ttl_type", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'ttl_type', type: 'string', nullable: false)]
private string $ttlType = 'N / A'; private string $ttlType = 'N / A';
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="is_p_ttl", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: false)]
private bool $isPTtl = false; private bool $isPTtl = false;
/** /**
* @var string * @var string
*
* @ORM\Column(name="p_ttl_type", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: false)]
private string $pTtlType = 'N / A'; private string $pTtlType = 'N / A';
/** /**
* @var string * @var string
*
* @ORM\Column(name="guide_number", type="string", nullable=true)
*/ */
#[ORM\Column(name: 'guide_number', type: 'string', nullable: true)]
private 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 ?string $purchasePrice; private ?string $purchasePrice;
/** /**
* @var string * @var string
*
* @ORM\Column(name="batteries", type="string", nullable=false)
*/ */
#[ORM\Column(name: 'batteries', type: 'string', nullable: false)]
private string $batteries = '4x AA'; private string $batteries = '4x AA';
/** /**
* @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;
/** /**
* @var string * @var string
*
* @ORM\Column(name="serial", type="string", nullable=true)
*/ */
#[ORM\Column(name: 'serial', type: 'string', nullable: true)]
private ?string $serial; private ?string $serial;
/** /**

View File

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

View File

@ -6,21 +6,19 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.previouslyOwnedCamera * Camera.previouslyOwnedCamera
*
* @ORM\Table(name="previously_owned_camera", schema="camera", indexes={@ORM\Index(name="IDX_6EF94C6BC54C8C93", columns={"type_id"})})
* @ORM\Entity(repositoryClass="App\Repository\CameraRepository")
*/ */
#[ORM\Table(name: 'previously_owned_camera', schema: 'camera')]
#[ORM\Index(name: 'IDX_6EF94C6BC54C8C93', columns: ['type_id'])]
#[ORM\Entity(repositoryClass: 'App\Repository\CameraRepository')]
class PreviouslyOwnedCamera class PreviouslyOwnedCamera
{ {
use CameraTrait; use CameraTrait;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\SequenceGenerator(sequenceName="prevously_owned_camera_id_seq", allocationSize=1, initialValue=1)
*/ */
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)]
private $id; private $id;
} }

View File

@ -6,35 +6,27 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.flash * Camera.flash
*
* @ORM\Table(name="previously_owned_flash", schema="camera")
* @ORM\Entity
*/ */
#[ORM\Table(name: 'previously_owned_flash', schema: 'camera')]
#[ORM\Entity]
class PreviouslyOwnedFlash class PreviouslyOwnedFlash
{ {
use FlashTrait; use FlashTrait;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/ */
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id; private $id;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false, options={"default" : true})
*/ */
#[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => true])]
private bool $received = true; private bool $received = true;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false, options={"default" : true})
*/ */
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => true])]
private bool $formerlyOwned = true; private bool $formerlyOwned = true;
} }

View File

@ -6,33 +6,27 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Camera.previouslyOwnedLenses * Camera.previouslyOwnedLenses
*
* @ORM\Table(name="previously_owned_lenses", schema="camera")
* @ORM\Entity(repositoryClass="App\Repository\LensesRepository")
*/ */
#[ORM\Table(name: 'previously_owned_lenses', schema: 'camera')]
#[ORM\Entity(repositoryClass: 'App\Repository\LensesRepository')]
class PreviouslyOwnedLenses class PreviouslyOwnedLenses
{ {
use LensTrait; use LensTrait;
/** /**
* @var integer * @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/ */
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id; private $id;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'received', type: 'boolean', nullable: false)]
private bool $received = true; private bool $received = true;
/** /**
* @var boolean * @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/ */
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
private bool $formerlyOwned = true; private bool $formerlyOwned = true;
} }

View File

@ -2,6 +2,8 @@
namespace App\Repository; namespace App\Repository;
use ReflectionObject;
use Throwable;
trait AcquireTrait { trait AcquireTrait {
/** /**
@ -15,8 +17,8 @@ trait AcquireTrait {
{ {
$em = $this->getEntityManager(); $em = $this->getEntityManager();
$old = new \ReflectionObject($currentRecord); $old = new ReflectionObject($currentRecord);
$new = new \ReflectionObject($newRecord); $new = new ReflectionObject($newRecord);
foreach ($old->getProperties() as $property) { foreach ($old->getProperties() as $property) {
$propertyName = $property->getName(); $propertyName = $property->getName();
@ -34,7 +36,7 @@ trait AcquireTrait {
$em->remove($currentRecord); $em->remove($currentRecord);
$em->flush(); $em->flush();
} }
catch (\Throwable $e) catch (Throwable $e)
{ {
dump($newRecord); dump($newRecord);
} }