ILIAS  trunk Revision v12.0_alpha-399-g579a087ced2
ILIAS\News\Data\Factory Class Reference

Factory for creating News DTOs from database results (arrays) More...

+ Collaboration diagram for ILIAS\News\Data\Factory:

Public Member Functions

 __construct ()
 
 newsItem (array $row)
 

Protected Attributes

readonly DateTimeZone $db_timezone
 

Detailed Description

Factory for creating News DTOs from database results (arrays)

Definition at line 28 of file Factory.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\News\Data\Factory::__construct ( )

Definition at line 32 of file Factory.php.

33 {
34 $this->db_timezone = new \DateTimeZone('UTC');
35 }

Member Function Documentation

◆ newsItem()

ILIAS\News\Data\Factory::newsItem ( array  $row)

Definition at line 37 of file Factory.php.

37 : NewsItem
38 {
39 return new NewsItem(
40 id: (int) $row['id'],
41 title: (string) $row['title'],
42 content: (string) $row['content'],
43 context_obj_id: (int) $row['context_obj_id'],
44 context_obj_type: (string) $row['context_obj_type'],
45 context_sub_obj_id: (int) $row['context_sub_obj_id'],
46 context_sub_obj_type: $row['context_sub_obj_type'] ?? null,
47 content_type: (string) $row['content_type'],
48 creation_date: new DateTimeImmutable($row['creation_date']), // currently date is stored in server tz, not UTC
49 update_date: new DateTimeImmutable($row['update_date']),
50 user_id: (int) $row['user_id'],
51 update_user_id: (int) $row['update_user_id'],
52 visibility: (string) $row['visibility'],
53 content_long: (string) $row['content_long'],
54 priority: (int) $row['priority'],
55 content_is_lang_var: (bool) $row['content_is_lang_var'],
56 content_text_is_lang_var: (bool) $row['content_text_is_lang_var'],
57 mob_id: (int) $row['mob_id'],
58 playtime: (string) $row['playtime'],
59 mob_cnt_play: (int) $row['mob_cnt_play'],
60 mob_cnt_download: (int) $row['mob_cnt_download'],
61 content_html: (bool) $row['content_html'],
62 context_ref_id: (int) ($row['ref_id'] ?? 0)
63 );
64 }

Field Documentation

◆ $db_timezone

readonly DateTimeZone ILIAS\News\Data\Factory::$db_timezone
protected

Definition at line 30 of file Factory.php.


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