OrderInvoice::getOrder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use Symfony\Component\Serializer\Attribute\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Attribute\Groups was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
use ApiPlatform\Metadata\ApiResource;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiResource was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use ApiPlatform\Metadata\ApiFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiFilter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use ApiPlatform\Metadata\Get;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Get was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use ApiPlatform\Metadata\GetCollection;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\GetCollection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use ApiPlatform\Metadata\Post;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Post was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\SearchFilter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use ControleOnline\Entity\Invoice;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Invoice was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use ControleOnline\Entity\Order;
16
use ControleOnline\Listener\LogListener;
17
18
#[ORM\Table(name: 'order_invoice')]
19
#[ORM\Index(name: 'invoice_id', columns: ['invoice_id'])]
20
#[ORM\UniqueConstraint(name: 'order_id', columns: ['order_id', 'invoice_id'])]
21
#[ORM\EntityListeners([LogListener::class])]
22
#[ORM\Entity]
23
#[ApiResource(
24
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
25
    normalizationContext: ['groups' => ['order_invoice:read']],
26
    denormalizationContext: ['groups' => ['order_invoice:write']],
27
    operations: [
28
        new GetCollection(security: "is_granted('ROLE_CLIENT')"),
29
        new Get(security: "is_granted('ROLE_CLIENT')"),
30
        new Post(
31
            security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')",
32
            validationContext: ['groups' => ['order_invoice:write']],
33
            denormalizationContext: ['groups' => ['order_invoice:write']]
34
        )
35
    ]
36
)]
37
#[ApiFilter(SearchFilter::class, properties: [
38
    'invoice' => 'exact',
39
    'order' => 'exact'
40
])]
41
class OrderInvoice
42
{
43
    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
44
    #[ORM\Id]
45
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
46
    #[Groups(['order_invoice:read', 'order:read'])]
47
    private $id;
48
49
    #[ORM\ManyToOne(targetEntity: Invoice::class, inversedBy: 'order', cascade: ['persist'])]
50
    #[ORM\JoinColumn(name: 'invoice_id', referencedColumnName: 'id')]
51
    #[Groups(['order_invoice:read', 'order:read', 'order_details:read', 'order:write',  'order_invoice:write'])]
52
    private $invoice;
53
54
    #[ORM\ManyToOne(targetEntity: Order::class, inversedBy: 'invoice', cascade: ['persist'])]
55
    #[ORM\JoinColumn(name: 'order_id', referencedColumnName: 'id')]
56
    #[Groups(['invoice:read', 'invoice_details:read', 'order_invoice:read', 'order_invoice:write'])]
57
    private $order;
58
59
    #[ORM\Column(name: 'real_price', type: 'float', nullable: false)]
60
    #[Groups(['order_invoice:read', 'order:read', 'order_details:read', 'order:write',  'order_invoice:write'])]
61
    private $realPrice = 0;
62
63
    public function getId()
64
    {
65
        return $this->id;
66
    }
67
68
    public function setInvoice(Invoice $invoice)
69
    {
70
        $this->invoice = $invoice;
71
        return $this;
72
    }
73
74
    public function getInvoice()
75
    {
76
        return $this->invoice;
77
    }
78
79
    public function setOrder(Order $order)
80
    {
81
        $this->order = $order;
82
        return $this;
83
    }
84
85
    public function getOrder()
86
    {
87
        return $this->order;
88
    }
89
90
    public function setRealPrice($realPrice)
91
    {
92
        $this->realPrice = $realPrice;
93
        return $this;
94
    }
95
96
    public function getRealPrice()
97
    {
98
        return $this->realPrice;
99
    }
100
}
101