Use ColumnSecurity for remaing part properties.

This commit is contained in:
Jan Böhmer 2019-03-20 22:30:03 +01:00
parent 47fe76b22e
commit b5fecee465
2 changed files with 35 additions and 1 deletions

View file

@ -62,6 +62,8 @@ class Part extends AttachmentContainingDBElement
* @var Footprint|null * @var Footprint|null
* @ORM\ManyToOne(targetEntity="Footprint", inversedBy="parts") * @ORM\ManyToOne(targetEntity="Footprint", inversedBy="parts")
* @ORM\JoinColumn(name="id_footprint", referencedColumnName="id") * @ORM\JoinColumn(name="id_footprint", referencedColumnName="id")
*
* @ColumnSecurity(prefix="footprint", type="object")
*/ */
protected $footprint; protected $footprint;
@ -69,6 +71,8 @@ class Part extends AttachmentContainingDBElement
* @var Storelocation|null * @var Storelocation|null
* @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="parts") * @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="parts")
* @ORM\JoinColumn(name="id_storelocation", referencedColumnName="id") * @ORM\JoinColumn(name="id_storelocation", referencedColumnName="id")
*
* @ColumnSecurity(prefix="storelocation", type="object")
*/ */
protected $storelocation; protected $storelocation;
@ -76,6 +80,8 @@ class Part extends AttachmentContainingDBElement
* @var Manufacturer|null * @var Manufacturer|null
* @ORM\ManyToOne(targetEntity="Manufacturer", inversedBy="parts") * @ORM\ManyToOne(targetEntity="Manufacturer", inversedBy="parts")
* @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id") * @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id")
*
* @ColumnSecurity(prefix="manufacturer", type="object")
*/ */
protected $manufacturer; protected $manufacturer;
@ -83,12 +89,16 @@ class Part extends AttachmentContainingDBElement
* @var Attachment * @var Attachment
* @ORM\ManyToOne(targetEntity="Attachment") * @ORM\ManyToOne(targetEntity="Attachment")
* @ORM\JoinColumn(name="id_master_picture_attachement", referencedColumnName="id") * @ORM\JoinColumn(name="id_master_picture_attachement", referencedColumnName="id")
*
* @ColumnSecurity(prefix="attachments", type="object")
*/ */
protected $master_picture_attachment; protected $master_picture_attachment;
/** /**
* @var * @var
* @ORM\OneToMany(targetEntity="Orderdetail", mappedBy="part") * @ORM\OneToMany(targetEntity="Orderdetail", mappedBy="part")
*
* @ColumnSecurity(prefix="orderdetails", type="object")
*/ */
protected $orderdetails; protected $orderdetails;
@ -96,12 +106,27 @@ class Part extends AttachmentContainingDBElement
* @var Orderdetail * @var Orderdetail
* @ORM\OneToOne(targetEntity="Orderdetail") * @ORM\OneToOne(targetEntity="Orderdetail")
* @ORM\JoinColumn(name="order_orderdetails_id", referencedColumnName="id") * @ORM\JoinColumn(name="order_orderdetails_id", referencedColumnName="id")
*
* @ColumnSecurity(prefix="order", type="object")
*/ */
protected $order_orderdetail; protected $order_orderdetail;
//TODO //TODO
protected $devices; 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 * Propertys
@ -157,24 +182,28 @@ class Part extends AttachmentContainingDBElement
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @ColumnSecurity(type="boolean")
*/ */
protected $favorite = false; protected $favorite = false;
/** /**
* @var int * @var int
* @ORM\Column(type="integer") * @ORM\Column(type="integer")
* @ColumnSecurity(prefix="order", type="integer")
*/ */
protected $order_quantity = 0; protected $order_quantity = 0;
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @ColumnSecurity(prefix="order", type="boolean")
*/ */
protected $manual_order = false; protected $manual_order = false;
/** /**
* @var string * @var string
* @ORM\Column(type="string") * @ORM\Column(type="string")
*@ColumnSecurity(prefix="manufacturer", type="string", placeholder="")
*/ */
protected $manufacturer_product_url = ""; protected $manufacturer_product_url = "";

View file

@ -68,7 +68,7 @@ class ColumnSecurity
/** /**
* @var string The name of the property. This is used to determine the default placeholder. * @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'; public $type = 'string';
@ -101,6 +101,11 @@ class ColumnSecurity
return '???'; return '???';
case 'object': case 'object':
return null; return null;
case 'boolean':
return false;
case 'datetime':
$date = new \DateTime();
return $date->setTimestamp(0);
} }
} }