Added an admin page for currencies.

This commit is contained in:
Jan Böhmer 2019-08-12 23:45:21 +02:00
parent 87e6f641c3
commit 2468409212
15 changed files with 374 additions and 9 deletions

View file

@ -69,6 +69,17 @@ class MeasurementUnit extends StructuralDBElement
*/
protected $usesSIPrefixes;
/**
* @ORM\OneToMany(targetEntity="MeasurementUnit", mappedBy="parent", cascade={"persist"})
*/
protected $children;
/**
* @ORM\ManyToOne(targetEntity="MeasurementUnit", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.

View file

@ -49,7 +49,7 @@ class Currency extends StructuralDBElement
/**
* @var string The 3 letter ISO code of the currency.
* @ORM\Column(type="string", unique=true, nullable=true)
* @ORM\Column(type="string", unique=true)
* @Assert\Currency()
*/
protected $iso_code;
@ -57,16 +57,27 @@ class Currency extends StructuralDBElement
/**
* @var float|null The exchange rate between this currency and the base currency
* (how many base units the current currency is worth)
* @ORM\Column(type="decimal", precision=11, scale=5)
* @ORM\Column(type="decimal", precision=11, scale=5, nullable=true)
* @Assert\Positive()
*/
protected $exchange_rate;
/**
* @ORM\OneToMany(targetEntity="Currency", mappedBy="parent", cascade={"persist"})
*/
protected $children;
/**
* @ORM\ManyToOne(targetEntity="Currency", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
/**
* Returns the 3 letter ISO code of this currency
* @return string
*/
public function getIsoCode(): string
public function getIsoCode(): ?string
{
return $this->iso_code;
}