1+ <?php
2+
3+ namespace Fusio \Impl \Table \Generated ;
4+
5+ class AgentMessageRow implements \JsonSerializable, \PSX \Record \RecordableInterface
6+ {
7+ private ?int $ id = null ;
8+ private ?int $ agentId = null ;
9+ private ?int $ userId = null ;
10+ private ?int $ parentId = null ;
11+ private ?int $ origin = null ;
12+ private ?string $ content = null ;
13+ private ?\PSX \DateTime \LocalDateTime $ insertDate = null ;
14+ public function setId (int $ id ): void
15+ {
16+ $ this ->id = $ id ;
17+ }
18+ public function getId (): int
19+ {
20+ return $ this ->id ?? throw new \PSX \Sql \Exception \NoValueAvailable ('No value for required column "id" was provided ' );
21+ }
22+ public function setAgentId (int $ agentId ): void
23+ {
24+ $ this ->agentId = $ agentId ;
25+ }
26+ public function getAgentId (): int
27+ {
28+ return $ this ->agentId ?? throw new \PSX \Sql \Exception \NoValueAvailable ('No value for required column "agent_id" was provided ' );
29+ }
30+ public function setUserId (int $ userId ): void
31+ {
32+ $ this ->userId = $ userId ;
33+ }
34+ public function getUserId (): int
35+ {
36+ return $ this ->userId ?? throw new \PSX \Sql \Exception \NoValueAvailable ('No value for required column "user_id" was provided ' );
37+ }
38+ public function setParentId (?int $ parentId ): void
39+ {
40+ $ this ->parentId = $ parentId ;
41+ }
42+ public function getParentId (): ?int
43+ {
44+ return $ this ->parentId ;
45+ }
46+ public function setOrigin (int $ origin ): void
47+ {
48+ $ this ->origin = $ origin ;
49+ }
50+ public function getOrigin (): int
51+ {
52+ return $ this ->origin ?? throw new \PSX \Sql \Exception \NoValueAvailable ('No value for required column "origin" was provided ' );
53+ }
54+ public function setContent (string $ content ): void
55+ {
56+ $ this ->content = $ content ;
57+ }
58+ public function getContent (): string
59+ {
60+ return $ this ->content ?? throw new \PSX \Sql \Exception \NoValueAvailable ('No value for required column "content" was provided ' );
61+ }
62+ public function setInsertDate (\PSX \DateTime \LocalDateTime $ insertDate ): void
63+ {
64+ $ this ->insertDate = $ insertDate ;
65+ }
66+ public function getInsertDate (): \PSX \DateTime \LocalDateTime
67+ {
68+ return $ this ->insertDate ?? throw new \PSX \Sql \Exception \NoValueAvailable ('No value for required column "insert_date" was provided ' );
69+ }
70+ public function toRecord (): \PSX \Record \RecordInterface
71+ {
72+ /** @var \PSX\Record\Record<mixed> $record */
73+ $ record = new \PSX \Record \Record ();
74+ $ record ->put ('id ' , $ this ->id );
75+ $ record ->put ('agent_id ' , $ this ->agentId );
76+ $ record ->put ('user_id ' , $ this ->userId );
77+ $ record ->put ('parent_id ' , $ this ->parentId );
78+ $ record ->put ('origin ' , $ this ->origin );
79+ $ record ->put ('content ' , $ this ->content );
80+ $ record ->put ('insert_date ' , $ this ->insertDate );
81+ return $ record ;
82+ }
83+ public function jsonSerialize (): object
84+ {
85+ return (object ) $ this ->toRecord ()->getAll ();
86+ }
87+ public static function from (array |\ArrayAccess $ data ): self
88+ {
89+ $ row = new self ();
90+ $ row ->id = isset ($ data ['id ' ]) && is_int ($ data ['id ' ]) ? $ data ['id ' ] : null ;
91+ $ row ->agentId = isset ($ data ['agent_id ' ]) && is_int ($ data ['agent_id ' ]) ? $ data ['agent_id ' ] : null ;
92+ $ row ->userId = isset ($ data ['user_id ' ]) && is_int ($ data ['user_id ' ]) ? $ data ['user_id ' ] : null ;
93+ $ row ->parentId = isset ($ data ['parent_id ' ]) && is_int ($ data ['parent_id ' ]) ? $ data ['parent_id ' ] : null ;
94+ $ row ->origin = isset ($ data ['origin ' ]) && is_int ($ data ['origin ' ]) ? $ data ['origin ' ] : null ;
95+ $ row ->content = isset ($ data ['content ' ]) && is_string ($ data ['content ' ]) ? $ data ['content ' ] : null ;
96+ $ row ->insertDate = isset ($ data ['insert_date ' ]) && $ data ['insert_date ' ] instanceof \DateTimeInterface ? \PSX \DateTime \LocalDateTime::from ($ data ['insert_date ' ]) : null ;
97+ return $ row ;
98+ }
99+ }
0 commit comments