ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ObjectStandardAdapter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 protected ?\ilObject $object = null;
26
27 public function __construct(int $ref_id)
28 {
29 if ($ref_id > 0) {
30 $this->object = \ilObjectFactory::getInstanceByRefId($ref_id, false);
31 }
32 }
33
35 {
36 $inst = new self($ref_id);
37 if ($inst->getRefId() === $ref_id) {
38 return $inst;
39 }
40 return null;
41 }
42
43 public function getId(): int
44 {
45 return $this->object->getId();
46 }
47 public function getType(): string
48 {
49 return $this->object->getType();
50 }
51
52 public function getTitle(): string
53 {
54 return $this->object->getTitle();
55 }
56
57 public function getRefId(): int
58 {
59 if (is_null($this->object)) {
60 return 0;
61 }
62 return $this->object->getRefId();
63 }
64
65 public function delete(): void
66 {
67 $this->object->delete();
68 }
69}
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObject Basic functions for all objects.
$ref_id
Definition: ltiauth.php:66
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...