Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
entity.php
1<?php
2
4
11
12abstract class Entity implements \ArrayAccess
13{
14 use \Bitrix\Forum\Internals\EntityBaseMethods;
15
17 protected $authorId;
19 protected $forum;
21 protected $data;
22
23 public function __construct($id)
24 {
25 $this->id = $id;
26 if ($id <= 0)
27 {
28 throw new \Bitrix\Main\ArgumentNullException(static::class . " empty id.");
29 }
30 $this->init();
31
32 $this->forum = new Forum($this->data["FORUM_ID"]);
33
34 if ($this->authorId === null)
35 {
36 throw new \Bitrix\Main\ArgumentNullException("Author id must be defined.");
37 }
38
39 $this->errorCollection = new \Bitrix\Main\ErrorCollection();
40 }
45 abstract protected function init();
46
47 public function getId()
48 {
49 return $this->id;
50 }
51
52 public function getForumId()
53 {
54 return $this->forum->getId();
55 }
56
57 public function getAuthorId()
58 {
59 return $this->authorId;
60 }
61 // entity actions
62 abstract public function edit(array $fields);
63 abstract public function remove();
64 abstract public static function create($parentObject, array $fields);
65
66 // crud actions
67 //abstract public static function add($parentObject, array $fields);
68 abstract public static function update(int $id, array &$fields);
69 abstract public static function delete(int $id);
70}
static create($parentObject, array $fields)
static update(int $id, array &$fields)