ILIAS  release_8 Revision v8.24
ilMDEntity Class Reference
+ Inheritance diagram for ilMDEntity:
+ Collaboration diagram for ilMDEntity:

Public Member Functions

 setEntity (string $a_entity)
 
 getEntity ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (ilXmlWriter $writer)
 
- Public Member Functions inherited from ilMDBase
 __construct (int $a_rbac_id=0, int $a_obj_id=0, string $a_type='')
 constructor More...
 
 read ()
 
 setRBACId (int $a_id)
 
 getRBACId ()
 
 setObjId (int $a_id)
 
 getObjId ()
 
 setObjType (string $a_type)
 
 getObjType ()
 
 setMetaId (int $a_meta_id, bool $a_read_data=true)
 
 getMetaId ()
 
 setParentType (string $a_parent_type)
 
 getParentType ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 setExportMode (bool $a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (ilXmlWriter $writer)
 

Static Public Member Functions

static _getIds (int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
 

Private Attributes

string $entity = ''
 

Additional Inherited Members

- Protected Attributes inherited from ilMDBase
ilLogger $log
 
ilDBInterface $db
 

Detailed Description

Definition at line 26 of file class.ilMDEntity.php.

Member Function Documentation

◆ __getFields()

ilMDEntity::__getFields ( )
Returns
array<string, array<string, mixed>>

Definition at line 79 of file class.ilMDEntity.php.

79 : array
80 {
81 return array(
82 'rbac_id' => array('integer', $this->getRBACId()),
83 'obj_id' => array('integer', $this->getObjId()),
84 'obj_type' => array('text', $this->getObjType()),
85 'parent_type' => array('text', $this->getParentType()),
86 'parent_id' => array('integer', $this->getParentId()),
87 'entity' => array('text', $this->getEntity())
88 );
89 }

References getEntity(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), and ilMDBase\getRBACId().

Referenced by save(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds()

static ilMDEntity::_getIds ( int  $a_rbac_id,
int  $a_obj_id,
int  $a_parent_id,
string  $a_parent_type 
)
static
Returns
int[]

Definition at line 120 of file class.ilMDEntity.php.

120 : array
121 {
122 global $DIC;
123
124 $ilDB = $DIC->database();
125
126 $query = "SELECT meta_entity_id FROM il_meta_entity " .
127 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
128 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
129 "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
130 "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
131 "ORDER BY meta_entity_id ";
132
133 $res = $ilDB->query($query);
134 $ids = [];
135 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
136 $ids[] = (int) $row->meta_entity_id;
137 }
138 return $ids;
139 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilMDContribute\getEntityIds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMDEntity::delete ( )

Reimplemented from ilMDBase.

Definition at line 62 of file class.ilMDEntity.php.

62 : bool
63 {
64 if ($this->getMetaId()) {
65 $query = "DELETE FROM il_meta_entity " .
66 "WHERE meta_entity_id = " . $this->db->quote($this->getMetaId(), 'integer');
67 $res = $this->db->manipulate($query);
68
69 $this->db->query($query);
70
71 return true;
72 }
73 return false;
74 }

References $query, $res, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ getEntity()

ilMDEntity::getEntity ( )

Definition at line 36 of file class.ilMDEntity.php.

36 : string
37 {
38 return $this->entity;
39 }

References $entity.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ read()

ilMDEntity::read ( )

Reimplemented from ilMDBase.

Definition at line 91 of file class.ilMDEntity.php.

91 : bool
92 {
93 if ($this->getMetaId()) {
94 $query = "SELECT * FROM il_meta_entity " .
95 "WHERE meta_entity_id = " . $this->db->quote($this->getMetaId(), 'integer');
96
97 $res = $this->db->query($query);
98 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
99 $this->setRBACId((int) $row->rbac_id);
100 $this->setObjId((int) $row->obj_id);
101 $this->setObjType($row->obj_type);
102 $this->setParentId((int) $row->parent_id);
103 $this->setParentType($row->parent_type);
104 $this->setEntity($row->entity ?? '');
105 }
106 }
107 return true;
108 }
setObjType(string $a_type)
setParentType(string $a_parent_type)
setObjId(int $a_id)
setRBACId(int $a_id)
setParentId(int $a_id)
setEntity(string $a_entity)

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setEntity(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), and ilMDBase\setRBACId().

+ Here is the call graph for this function:

◆ save()

ilMDEntity::save ( )

Reimplemented from ilMDBase.

Definition at line 41 of file class.ilMDEntity.php.

41 : int
42 {
43 $fields = $this->__getFields();
44 $fields['meta_entity_id'] = array('integer', $next_id = $this->db->nextId('il_meta_entity'));
45
46 if ($this->db->insert('il_meta_entity', $fields)) {
47 $this->setMetaId($next_id);
48 return $this->getMetaId();
49 }
50 return 0;
51 }
setMetaId(int $a_meta_id, bool $a_read_data=true)

References __getFields(), ilMDBase\getMetaId(), and ilMDBase\setMetaId().

+ Here is the call graph for this function:

◆ setEntity()

ilMDEntity::setEntity ( string  $a_entity)

Definition at line 31 of file class.ilMDEntity.php.

31 : void
32 {
33 $this->entity = $a_entity;
34 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toXML()

ilMDEntity::toXML ( ilXmlWriter  $writer)

Reimplemented from ilMDBase.

Definition at line 110 of file class.ilMDEntity.php.

110 : void
111 {
112 $writer->xmlElement('Entity', null, $this->getEntity());
113 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)

References getEntity(), and ilXmlWriter\xmlElement().

+ Here is the call graph for this function:

◆ update()

ilMDEntity::update ( )

Reimplemented from ilMDBase.

Definition at line 53 of file class.ilMDEntity.php.

53 : bool
54 {
55 return $this->getMetaId() && $this->db->update(
56 'il_meta_entity',
57 $this->__getFields(),
58 array("meta_entity_id" => array('integer', $this->getMetaId()))
59 );
60 }

References __getFields(), and ilMDBase\getMetaId().

+ Here is the call graph for this function:

Field Documentation

◆ $entity

string ilMDEntity::$entity = ''
private

Definition at line 28 of file class.ilMDEntity.php.

Referenced by getEntity().


The documentation for this class was generated from the following file: