Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
template.php
1<?php
9
12use Bitrix\Tasks\Exception;
13
14Loc::loadMessages(__FILE__);
15
16class Template extends Base
17{
23 protected function getDefaultData()
24 {
25 return array(
26 'NAME' => '',
27 'CONTENT' => '',
28 );
29 }
30
37 protected function loadData($id)
38 {
39 return TemplateTable::getRowById($id);
40 }
41
49 protected function saveData($id, array $data)
50 {
51 return $this->saveByEntity(TemplateTable::getEntity(), $id, $data);
52 }
53
59 public function remove()
60 {
61 return $this->removeByEntity(TemplateTable::getEntity(), $this->getId());
62 }
63
69 public function copy()
70 {
71 $data = [
72 'ACTIVE' => $this->data['ACTIVE'],
73 'NAME' => $this->data['NAME'],
74 'CONTENT' => $this->data['CONTENT'],
75 ];
76 $instance = static::create()->mergeData($data);
77 return $instance->save();
78 }
79
80
87 public static function removeById($id)
88 {
89 return static::create()->removeByEntity(TemplateTable::getEntity(), $id);
90 }
91}
static loadMessages($file)
Definition loc.php:64
saveData($id, array $data)
Definition template.php:49