mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Use ColumnSecurity for remaing part properties.
This commit is contained in:
parent
47fe76b22e
commit
b5fecee465
2 changed files with 35 additions and 1 deletions
|
@ -62,6 +62,8 @@ class Part extends AttachmentContainingDBElement
|
|||
* @var Footprint|null
|
||||
* @ORM\ManyToOne(targetEntity="Footprint", inversedBy="parts")
|
||||
* @ORM\JoinColumn(name="id_footprint", referencedColumnName="id")
|
||||
*
|
||||
* @ColumnSecurity(prefix="footprint", type="object")
|
||||
*/
|
||||
protected $footprint;
|
||||
|
||||
|
@ -69,6 +71,8 @@ class Part extends AttachmentContainingDBElement
|
|||
* @var Storelocation|null
|
||||
* @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="parts")
|
||||
* @ORM\JoinColumn(name="id_storelocation", referencedColumnName="id")
|
||||
*
|
||||
* @ColumnSecurity(prefix="storelocation", type="object")
|
||||
*/
|
||||
protected $storelocation;
|
||||
|
||||
|
@ -76,6 +80,8 @@ class Part extends AttachmentContainingDBElement
|
|||
* @var Manufacturer|null
|
||||
* @ORM\ManyToOne(targetEntity="Manufacturer", inversedBy="parts")
|
||||
* @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id")
|
||||
*
|
||||
* @ColumnSecurity(prefix="manufacturer", type="object")
|
||||
*/
|
||||
protected $manufacturer;
|
||||
|
||||
|
@ -83,12 +89,16 @@ class Part extends AttachmentContainingDBElement
|
|||
* @var Attachment
|
||||
* @ORM\ManyToOne(targetEntity="Attachment")
|
||||
* @ORM\JoinColumn(name="id_master_picture_attachement", referencedColumnName="id")
|
||||
*
|
||||
* @ColumnSecurity(prefix="attachments", type="object")
|
||||
*/
|
||||
protected $master_picture_attachment;
|
||||
|
||||
/**
|
||||
* @var
|
||||
* @ORM\OneToMany(targetEntity="Orderdetail", mappedBy="part")
|
||||
*
|
||||
* @ColumnSecurity(prefix="orderdetails", type="object")
|
||||
*/
|
||||
protected $orderdetails;
|
||||
|
||||
|
@ -96,12 +106,27 @@ class Part extends AttachmentContainingDBElement
|
|||
* @var Orderdetail
|
||||
* @ORM\OneToOne(targetEntity="Orderdetail")
|
||||
* @ORM\JoinColumn(name="order_orderdetails_id", referencedColumnName="id")
|
||||
*
|
||||
* @ColumnSecurity(prefix="order", type="object")
|
||||
*/
|
||||
protected $order_orderdetail;
|
||||
|
||||
//TODO
|
||||
protected $devices;
|
||||
|
||||
/**
|
||||
* @ColumnSecurity(type="datetime")
|
||||
* @ORM\Column(type="datetimetz", name="datetime_added")
|
||||
*/
|
||||
protected $addedDate;
|
||||
|
||||
/**
|
||||
* @var \DateTime The date when this element was modified the last time.
|
||||
* @ORM\Column(type="datetimetz", name="last_modified")
|
||||
* @ColumnSecurity(type="datetime")
|
||||
*/
|
||||
protected $lastModified;
|
||||
|
||||
|
||||
/**********************
|
||||
* Propertys
|
||||
|
@ -157,24 +182,28 @@ class Part extends AttachmentContainingDBElement
|
|||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ColumnSecurity(type="boolean")
|
||||
*/
|
||||
protected $favorite = false;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @ORM\Column(type="integer")
|
||||
* @ColumnSecurity(prefix="order", type="integer")
|
||||
*/
|
||||
protected $order_quantity = 0;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ColumnSecurity(prefix="order", type="boolean")
|
||||
*/
|
||||
protected $manual_order = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="string")
|
||||
*@ColumnSecurity(prefix="manufacturer", type="string", placeholder="")
|
||||
*/
|
||||
protected $manufacturer_product_url = "";
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class ColumnSecurity
|
|||
|
||||
/**
|
||||
* @var string The name of the property. This is used to determine the default placeholder.
|
||||
* @Annotation\Enum({"integer", "string", "object"})
|
||||
* @Annotation\Enum({"integer", "string", "object", "boolean", "datetime"})
|
||||
*/
|
||||
public $type = 'string';
|
||||
|
||||
|
@ -101,6 +101,11 @@ class ColumnSecurity
|
|||
return '???';
|
||||
case 'object':
|
||||
return null;
|
||||
case 'boolean':
|
||||
return false;
|
||||
case 'datetime':
|
||||
$date = new \DateTime();
|
||||
return $date->setTimestamp(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue