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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,18 +6,16 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Battery Type
*
* @ORM\Table(name="battery_type", schema="camera")
* @ORM\Entity
*/
#[ORM\Table(name: 'battery_type', schema: 'camera')]
#[ORM\Entity]
class BatteryType
{
/**
* @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;
}

View File

@ -6,22 +6,19 @@ use Doctrine\ORM\Mapping as ORM;
/**
* 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;
/**
* @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;
}

View File

@ -17,103 +17,87 @@ trait CameraTrait
/**
* @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;
/**
* @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;
/**
* @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;
/**
* @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;
/**
* @var boolean
*
* @ORM\Column(name="is_digital", type="boolean", nullable=false)
*/
#[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)]
private bool $isDigital;
/**
* @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';
/**
* @var boolean
*
* @ORM\Column(name="is_working", type="boolean", nullable=false)
*/
#[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)]
private bool $isWorking;
/**
* @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
#[ORM\Column(name: 'notes', type: 'text', nullable: true)]
private ?string $notes;
/**
* @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;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
private bool $formerlyOwned = FALSE;
/**
* @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]
private $purchasePrice;
/**
* @var string
*
* @ORM\Column(name="battery_type", type="string", nullable=true)
*/
#[ORM\Column(name: 'battery_type', type: 'string', nullable: true)]
private ?string $batteryType;
/**
* @var string
*
* @ORM\Column(name="film_format", type="string", nullable=true)
*/
#[ORM\Column(name: 'film_format', type: 'string', nullable: true)]
private ?string $filmFormat = '135';
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=true)
*/
#[ORM\Column(name: 'received', type: 'boolean', nullable: true)]
private ?bool $received = FALSE;
/**

View File

@ -6,37 +6,29 @@ use Doctrine\ORM\Mapping as ORM;
/**
* CameraType
*
* @ORM\Table(name="camera_type", schema="camera")
* @ORM\Entity
*/
#[ORM\Table(name: 'camera_type', schema: 'camera')]
#[ORM\Entity]
class CameraType
{
/**
* @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;
/**
* @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;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
#[ORM\Column(name: 'description', type: 'text', nullable: true)]
private ?string $description;
/**
* Value for serialization
*
@ -46,8 +38,6 @@ class CameraType
{
return $this->type;
}
/**
* Get id
*
@ -57,7 +47,6 @@ class CameraType
{
return $this->id;
}
/**
* Set type
*
@ -71,7 +60,6 @@ class CameraType
return $this;
}
/**
* Set description
*
@ -85,7 +73,6 @@ class CameraType
return $this;
}
/**
* Get type
*
@ -95,7 +82,6 @@ class CameraType
{
return $this->type;
}
/**
* Get description
*

View File

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

View File

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

View File

@ -6,36 +6,28 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Camera.flash
*
* @ORM\Table(name="flash", schema="camera")
* @ORM\Entity
*/
#[ORM\Table(name: 'flash', schema: 'camera')]
#[ORM\Entity]
class Flash
{
use FlashTrait;
/**
* @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;
/**
* @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;
/**
* @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;
}

View File

@ -10,86 +10,74 @@ trait FlashTrait
/**
* @var string
*
* @ORM\Column(name="brand", type="string", nullable=false)
*/
#[ORM\Column(name: 'brand', type: 'string', nullable: false)]
private string $brand;
/**
* @var string
*
* @ORM\Column(name="model", type="string", nullable=false)
*/
#[ORM\Column(name: 'model', type: 'string', nullable: false)]
private string $model;
/**
* @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;
/**
* @var boolean
*
* @ORM\Column(name="is_ttl", type="boolean", nullable=false)
*/
#[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: false)]
private bool $isTtl = false;
/**
* @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';
/**
* @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;
/**
* @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';
/**
* @var string
*
* @ORM\Column(name="guide_number", type="string", nullable=true)
*/
#[ORM\Column(name: 'guide_number', type: 'string', nullable: true)]
private string $guideNumber;
/**
* @var string
*
* @ORM\Column(name="purchase_price", type="money", nullable=true)
*/
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]
private ?string $purchasePrice;
/**
* @var string
*
* @ORM\Column(name="batteries", type="string", nullable=false)
*/
#[ORM\Column(name: 'batteries', type: 'string', nullable: false)]
private string $batteries = '4x AA';
/**
* @var string
*
* @ORM\Column(name="notes", type="text", nullable=true)
*/
#[ORM\Column(name: 'notes', type: 'text', nullable: true)]
private ?string $notes;
/**
* @var string
*
* @ORM\Column(name="serial", type="string", nullable=true)
*/
#[ORM\Column(name: 'serial', type: 'string', nullable: true)]
private ?string $serial;
/**

View File

@ -6,35 +6,28 @@ use Doctrine\ORM\Mapping as ORM;
/**
* 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
{
use LensTrait;
/**
* @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;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false)
*/
#[ORM\Column(name: 'received', type: 'boolean', nullable: false)]
private $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;
}

View File

@ -6,21 +6,19 @@ use Doctrine\ORM\Mapping as ORM;
/**
* 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
{
use CameraTrait;
/**
* @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;
}

View File

@ -6,35 +6,27 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Camera.flash
*
* @ORM\Table(name="previously_owned_flash", schema="camera")
* @ORM\Entity
*/
#[ORM\Table(name: 'previously_owned_flash', schema: 'camera')]
#[ORM\Entity]
class PreviouslyOwnedFlash
{
use FlashTrait;
/**
* @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;
/**
* @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;
/**
* @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;
}

View File

@ -6,33 +6,27 @@ use Doctrine\ORM\Mapping as ORM;
/**
* 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
{
use LensTrait;
/**
* @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;
/**
* @var boolean
*
* @ORM\Column(name="received", type="boolean", nullable=false)
*/
#[ORM\Column(name: 'received', type: 'boolean', nullable: false)]
private bool $received = true;
/**
* @var boolean
*
* @ORM\Column(name="formerly_owned", type="boolean", nullable=false)
*/
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)]
private bool $formerlyOwned = true;
}

View File

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