forms/lib/Db/Vote.php

74 lines
2.2 KiB
PHP
Raw Normal View History

2019-05-14 01:15:45 +02:00
<?php
declare(strict_types=1);
2019-05-14 01:15:45 +02:00
/**
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
*
* @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
* @author Kai Schröer <git@schroeer.co>
* @author René Gieling <github@dartcafe.de>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Forms\Db;
use OCP\AppFramework\Db\Entity;
/**
* @method integer getFormId()
* @method void setFormId(integer $value)
* @method string getUserId()
* @method void setUserId(string $value)
* @method integer getVoteOptionId()
* @method void setVoteOptionId(integer $value)
* @method string getVoteOptionText()
* @method void setVoteOptionText(string $value)
* @method string getVoteAnswer()
* @method void setVoteAnswer(string $value)
2019-05-14 09:03:59 +02:00
* @method string getVoteOptionType()
* @method void setVoteOptionType(string $value)
2019-05-14 01:15:45 +02:00
*/
class Vote extends Entity {
2019-05-14 01:15:45 +02:00
protected $formId;
protected $userId;
protected $voteOptionId;
protected $voteOptionText;
protected $voteAnswer;
2019-05-14 09:03:59 +02:00
protected $voteOptionType;
2019-05-14 01:15:45 +02:00
/**
* Options constructor.
*/
public function __construct() {
$this->addType('formId', 'integer');
$this->addType('voteOptionId', 'integer');
}
public function read(): array {
2019-05-14 01:15:45 +02:00
return [
'id' => $this->getId(),
'userId' => $this->getUserId(),
'voteOptionId' => $this->getVoteOptionId(),
'voteOptionText' => htmlspecialchars_decode($this->getVoteOptionText()),
2019-05-14 09:03:59 +02:00
'voteAnswer' => $this->getVoteAnswer(),
'voteOptionType' => $this->getVoteOptionType()
2019-05-14 01:15:45 +02:00
];
}
}