芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/avenida/lib/Entity/Help.php
setCommonDependencies($store, $log); } public function getId() { return $this->helpId; } public function getOwnerId() { return 1; } public function validate() { if (!v::stringType()->notEmpty()->length(1, 254)->validate($this->topic)) throw new InvalidArgumentException(__('Topic is a required field. It must be between 1 and 254 characters.'), 'topic'); if (!v::stringType()->notEmpty()->length(1, 254)->validate($this->category)) throw new InvalidArgumentException(__('Category is a required field. It must be between 1 and 254 characters.'), 'category'); if (!v::stringType()->notEmpty()->length(1, 254)->validate($this->link)) throw new InvalidArgumentException(__('Link is a required field. It must be between 1 and 254 characters.'), 'link'); } public function save($validate = true) { if ($validate) $this->validate(); if ($this->helpId == null || $this->helpId == 0) $this->add(); else $this->edit(); } public function delete() { $this->getStore()->update('DELETE FROM `help` WHERE HelpID = :helpid', [ 'helpId' => $this->helpId ]); } private function add() { $this->helpId = $this->getStore()->insert('INSERT INTO `help` (Topic, Category, Link) VALUES (:topic, :category, :link)', [ 'topic' => $this->topic, 'category' => $this->category, 'link' => $this->link ]); } private function edit() { $this->getStore()->update('UPDATE `help` SET Topic = :topic, Category = :category, Link = :link WHERE HelpID = :helpid', [ 'helpId' => $this->helpId, 'topic' => $this->topic, 'category' => $this->category, 'link' => $this->link ]); } }