chamilo /
chamilo-lms
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | /* For licensing terms, see /license.txt */ |
||||||
| 4 | |||||||
| 5 | declare(strict_types=1); |
||||||
| 6 | |||||||
| 7 | namespace Chamilo\LtiBundle\Entity; |
||||||
| 8 | |||||||
| 9 | use Chamilo\CoreBundle\Entity\GradebookEvaluation; |
||||||
| 10 | use DateTime; |
||||||
| 11 | use DateTimeInterface; |
||||||
| 12 | use Doctrine\ORM\Mapping as ORM; |
||||||
| 13 | |||||||
| 14 | #[ORM\Table(name: 'lti_lineitem')] |
||||||
| 15 | #[ORM\Entity] |
||||||
| 16 | class LineItem |
||||||
| 17 | { |
||||||
| 18 | #[ORM\Column(name: 'id', type: 'integer')] |
||||||
| 19 | #[ORM\Id] |
||||||
| 20 | #[ORM\GeneratedValue] |
||||||
| 21 | protected ?int $id = null; |
||||||
| 22 | |||||||
| 23 | #[ORM\ManyToOne(targetEntity: ExternalTool::class, inversedBy: 'lineItems')] |
||||||
| 24 | #[ORM\JoinColumn(name: 'tool_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] |
||||||
| 25 | private ExternalTool $tool; |
||||||
| 26 | |||||||
| 27 | #[ORM\OneToOne(targetEntity: GradebookEvaluation::class)] |
||||||
| 28 | #[ORM\JoinColumn(name: 'evaluation', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] |
||||||
| 29 | private GradebookEvaluation $evaluation; |
||||||
| 30 | |||||||
| 31 | #[ORM\Column(name: 'resource_id', type: 'string', nullable: true)] |
||||||
| 32 | private ?string $resourceId; |
||||||
| 33 | |||||||
| 34 | #[ORM\Column(name: 'tag', type: 'string', nullable: true)] |
||||||
| 35 | private ?string $tag; |
||||||
| 36 | |||||||
| 37 | #[ORM\Column(name: 'start_date', type: 'datetime', nullable: true)] |
||||||
| 38 | private ?DateTime $startDate; |
||||||
| 39 | |||||||
| 40 | #[ORM\Column(name: 'end_date', type: 'datetime', nullable: true)] |
||||||
| 41 | private ?DateTime $endDate; |
||||||
| 42 | |||||||
| 43 | public function getId(): ?int |
||||||
| 44 | { |
||||||
| 45 | return $this->id; |
||||||
| 46 | } |
||||||
| 47 | |||||||
| 48 | public function getTool(): ExternalTool |
||||||
| 49 | { |
||||||
| 50 | return $this->tool; |
||||||
| 51 | } |
||||||
| 52 | |||||||
| 53 | public function setTool(ExternalTool $tool): static |
||||||
| 54 | { |
||||||
| 55 | $this->tool = $tool; |
||||||
| 56 | |||||||
| 57 | return $this; |
||||||
| 58 | } |
||||||
| 59 | |||||||
| 60 | public function getEvaluation(): GradebookEvaluation |
||||||
| 61 | { |
||||||
| 62 | return $this->evaluation; |
||||||
| 63 | } |
||||||
| 64 | |||||||
| 65 | public function setEvaluation(GradebookEvaluation $evaluation): static |
||||||
| 66 | { |
||||||
| 67 | $this->evaluation = $evaluation; |
||||||
| 68 | |||||||
| 69 | return $this; |
||||||
| 70 | } |
||||||
| 71 | |||||||
| 72 | public function getTag(): string |
||||||
| 73 | { |
||||||
| 74 | return $this->tag; |
||||||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||||||
| 75 | } |
||||||
| 76 | |||||||
| 77 | public function setTag(string $tag): static |
||||||
| 78 | { |
||||||
| 79 | $this->tag = $tag; |
||||||
| 80 | |||||||
| 81 | return $this; |
||||||
| 82 | } |
||||||
| 83 | |||||||
| 84 | public function getStartDate(): DateTime |
||||||
| 85 | { |
||||||
| 86 | return $this->startDate; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 87 | } |
||||||
| 88 | |||||||
| 89 | public function setStartDate(DateTime $startDate): static |
||||||
| 90 | { |
||||||
| 91 | $this->startDate = $startDate; |
||||||
| 92 | |||||||
| 93 | return $this; |
||||||
| 94 | } |
||||||
| 95 | |||||||
| 96 | public function getEndDate(): DateTime |
||||||
| 97 | { |
||||||
| 98 | return $this->endDate; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 99 | } |
||||||
| 100 | |||||||
| 101 | public function setEndDate(DateTime $endDate): static |
||||||
| 102 | { |
||||||
| 103 | $this->endDate = $endDate; |
||||||
| 104 | |||||||
| 105 | return $this; |
||||||
| 106 | } |
||||||
| 107 | |||||||
| 108 | public function getResourceId(): string |
||||||
| 109 | { |
||||||
| 110 | return $this->resourceId; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 111 | } |
||||||
| 112 | |||||||
| 113 | public function setResourceId(string $resourceId): static |
||||||
| 114 | { |
||||||
| 115 | $this->resourceId = $resourceId; |
||||||
| 116 | |||||||
| 117 | return $this; |
||||||
| 118 | } |
||||||
| 119 | |||||||
| 120 | public function toArray(): array |
||||||
| 121 | { |
||||||
| 122 | $baseTool = $this->tool->getParent() ?: $this->tool; |
||||||
| 123 | |||||||
| 124 | $data = [ |
||||||
| 125 | 'scoreMaximum' => $this->evaluation->getMax(), |
||||||
| 126 | 'label' => $this->evaluation->getTitle(), |
||||||
| 127 | 'tag' => $this->tag, |
||||||
| 128 | 'resourceLinkId' => (string) $baseTool->getId(), |
||||||
|
0 ignored issues
–
show
The method
getId() does not exist on Chamilo\CoreBundle\Entity\AbstractResource. It seems like you code against a sub-type of Chamilo\CoreBundle\Entity\AbstractResource such as Chamilo\CoreBundle\Entity\Course or Chamilo\CoreBundle\Entity\PortfolioComment or Chamilo\CoreBundle\Entity\MessageAttachment or Chamilo\CourseBundle\Entity\CShortcut or Chamilo\CoreBundle\Entity\GradebookCertificate or Chamilo\CoreBundle\Entity\SocialPostAttachment or Chamilo\LtiBundle\Entity\ExternalTool or Chamilo\CoreBundle\Entity\PersonalFile or Chamilo\CourseBundle\Ent...ntPublicationCorrection or Chamilo\CoreBundle\Entity\Usergroup or Chamilo\CourseBundle\Entity\CChatConversation or Chamilo\CoreBundle\Entity\AccessUrl or Chamilo\CoreBundle\Entity\Portfolio or Chamilo\CoreBundle\Entity\TicketMessageAttachment or Chamilo\CourseBundle\Entity\CQuizCategory or Chamilo\CoreBundle\Entity\Illustration.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The method
getId() does not exist on Chamilo\CoreBundle\Entity\ResourceInterface. It seems like you code against a sub-type of Chamilo\CoreBundle\Entity\ResourceInterface such as Chamilo\CoreBundle\Entity\Course or Chamilo\CoreBundle\Entity\PortfolioComment or Chamilo\CoreBundle\Entity\MessageAttachment or Chamilo\CourseBundle\Entity\CShortcut or Chamilo\CoreBundle\Entity\GradebookCertificate or Chamilo\CoreBundle\Entity\SocialPostAttachment or Chamilo\LtiBundle\Entity\ExternalTool or Chamilo\CoreBundle\Entity\PersonalFile or Chamilo\CourseBundle\Ent...ntPublicationCorrection or Chamilo\CoreBundle\Entity\Usergroup or Chamilo\CourseBundle\Entity\CChatConversation or Chamilo\CoreBundle\Entity\AccessUrl or Chamilo\CoreBundle\Entity\Portfolio or Chamilo\CoreBundle\Entity\TicketMessageAttachment or Chamilo\CourseBundle\Entity\CQuizCategory or Chamilo\CoreBundle\Entity\Illustration or Chamilo\CoreBundle\Entity\User.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 129 | 'resourceId' => $this->resourceId, |
||||||
| 130 | ]; |
||||||
| 131 | |||||||
| 132 | if ($this->startDate) { |
||||||
| 133 | $data['startDateTime'] = $this->startDate->format(DateTimeInterface::ATOM); |
||||||
| 134 | } |
||||||
| 135 | |||||||
| 136 | if ($this->endDate) { |
||||||
| 137 | $data['endDateTime'] = $this->endDate->format(DateTimeInterface::ATOM); |
||||||
| 138 | } |
||||||
| 139 | |||||||
| 140 | return $data; |
||||||
| 141 | } |
||||||
| 142 | } |
||||||
| 143 |