Passed
Push — master ( dc38fb...7b9cc4 )
by Angel Fernando Quiroz
09:43 queued 19s
created

AccessUrlRelCourse::getCourse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use Chamilo\CoreBundle\Traits\CourseTrait;
10
use Doctrine\ORM\Mapping as ORM;
11
use Stringable;
12
13
/**
14
 * AccessUrlRelCourse.
15
 */
16
#[ORM\Table(name: 'access_url_rel_course')]
17
#[ORM\Entity]
18
class AccessUrlRelCourse implements EntityAccessUrlInterface, Stringable
19
{
20
    use CourseTrait;
21
22
    #[ORM\Column(name: 'id', type: 'integer')]
23
    #[ORM\Id]
24
    #[ORM\GeneratedValue]
25
    protected ?int $id = null;
26
27
    #[ORM\ManyToOne(targetEntity: Course::class, cascade: ['persist'], inversedBy: 'urls')]
28
    #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
29
    protected ?Course $course;
30
31
    #[ORM\ManyToOne(targetEntity: AccessUrl::class, cascade: ['persist'], inversedBy: 'courses')]
32
    #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
33
    protected ?AccessUrl $url;
34
35
    public function __toString(): string
36
    {
37
        return '-';
38
    }
39
40
    public function getId(): ?int
41
    {
42
        return $this->id;
43
    }
44
45
    public function getUrl(): ?AccessUrl
46
    {
47
        return $this->url;
48
    }
49
50
    public function setUrl(?AccessUrl $url): self
51
    {
52
        $this->url = $url;
53
54
        return $this;
55
    }
56
}
57