mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-17 16:21:30 +02:00
Fixed some inspection issues
This commit is contained in:
parent
33475dca66
commit
42e604245c
85 changed files with 272 additions and 291 deletions
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\PriceInformations;
|
||||
|
||||
use ApiPlatform\Doctrine\Common\Filter\DateFilterInterface;
|
||||
use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
|
||||
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
|
||||
use ApiPlatform\Metadata\ApiFilter;
|
||||
|
@ -60,8 +61,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
#[UniqueEntity('iso_code')]
|
||||
#[ORM\Entity(repositoryClass: CurrencyRepository::class)]
|
||||
#[ORM\Table(name: 'currencies')]
|
||||
#[ORM\Index(name: 'currency_idx_name', columns: ['name'])]
|
||||
#[ORM\Index(name: 'currency_idx_parent_name', columns: ['parent_id', 'name'])]
|
||||
#[ORM\Index(columns: ['name'], name: 'currency_idx_name')]
|
||||
#[ORM\Index(columns: ['parent_id', 'name'], name: 'currency_idx_parent_name')]
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
new Get(security: 'is_granted("read", object)'),
|
||||
|
@ -88,7 +89,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
)]
|
||||
#[ApiFilter(PropertyFilter::class)]
|
||||
#[ApiFilter(LikeFilter::class, properties: ["name", "comment", "iso_code"])]
|
||||
#[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)]
|
||||
#[ApiFilter(DateFilter::class, strategy: DateFilterInterface::EXCLUDE_NULL)]
|
||||
#[ApiFilter(OrderFilter::class, properties: ['name', 'id', 'addedDate', 'lastModified'])]
|
||||
class Currency extends AbstractStructuralDBElement
|
||||
{
|
||||
|
@ -99,7 +100,7 @@ class Currency extends AbstractStructuralDBElement
|
|||
* (how many base units the current currency is worth)
|
||||
*/
|
||||
#[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)]
|
||||
#[BigDecimalPositive()]
|
||||
#[BigDecimalPositive]
|
||||
#[Groups(['currency:read', 'currency:write'])]
|
||||
#[ApiProperty(readableLink: false, writableLink: false)]
|
||||
protected ?BigDecimal $exchange_rate = null;
|
||||
|
@ -116,7 +117,7 @@ class Currency extends AbstractStructuralDBElement
|
|||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $iso_code = "";
|
||||
|
||||
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent', cascade: ['persist'])]
|
||||
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class, cascade: ['persist'])]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $children;
|
||||
|
||||
|
@ -130,7 +131,7 @@ class Currency extends AbstractStructuralDBElement
|
|||
* @var Collection<int, CurrencyAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: CurrencyAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(mappedBy: 'element', targetEntity: CurrencyAttachment::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
#[Groups(['currency:read', 'currency:write'])]
|
||||
protected Collection $attachments;
|
||||
|
@ -143,14 +144,14 @@ class Currency extends AbstractStructuralDBElement
|
|||
/** @var Collection<int, CurrencyParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: CurrencyParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(mappedBy: 'element', targetEntity: CurrencyParameter::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
#[Groups(['currency:read', 'currency:write'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
/** @var Collection<int, Pricedetail>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Pricedetail::class, mappedBy: 'currency')]
|
||||
#[ORM\OneToMany(mappedBy: 'currency', targetEntity: Pricedetail::class)]
|
||||
protected Collection $pricedetails;
|
||||
|
||||
#[Groups(['currency:read'])]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue