passman/lib/Db/Vault.php

72 lines
1.9 KiB
PHP
Raw Normal View History

<?php
/**
* Nextcloud - passman
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Sander Brand <brantje@gmail.com>
* @copyright Sander Brand 2016
*/
namespace OCA\Passman\Db;
use \OCP\AppFramework\Db\Entity;
/**
* @method integer getId()
* @method void setId(integer $value)
* @method void setName(string $value)
* @method string getName()
* @method void setGuid(string $value)
* @method string getGuid()
* @method void setUserId(string $value)
* @method string getUserid()
* @method void setCreated(integer $value)
* @method integer getCreated()
2016-09-15 00:57:38 +08:00
* @method void setLastAccess(integer $value)
* @method integer getLastAccess()
2016-09-24 23:01:11 +08:00
* @method void setPublicSharingKey(string $value)
* @method string getPublicSharingKey()
* @method void setPrivateSharingKey(string $value)
* @method string getPrivateSharingKey()
* @method void setSharingKeysGenerated(integer $value)
* @method integer getSharingKeysGenerated()
2016-09-29 04:05:09 +08:00
* @method void setVaultSettings(integer $value)
* @method integer getVaultSettings()
*/
2016-09-11 19:07:39 +08:00
class Vault extends Entity implements \JsonSerializable{
use EntityJSONSerializer;
protected $guid;
protected $name;
protected $userId;
protected $created;
protected $lastAccess;
2016-09-24 23:01:11 +08:00
protected $publicSharingKey;
protected $privateSharingKey;
protected $sharingKeysGenerated;
2016-09-29 04:05:09 +08:00
protected $vaultSettings;
2016-10-01 02:56:17 +08:00
public function __construct() {
// add types in constructor
$this->addType('created', 'integer');
$this->addType('lastAccess', 'integer');
2016-09-29 02:26:59 +08:00
$this->addType('sharingKeysGenerated', 'integer');
}
2016-09-11 19:07:39 +08:00
/**
2016-09-15 00:57:38 +08:00
* Turns entity attributes into an array
2016-09-11 19:07:39 +08:00
*/
public function jsonSerialize() {
return [
2016-09-12 01:45:20 +08:00
'vault_id' => $this->getId(),
2016-09-11 19:07:39 +08:00
'guid' => $this->getGuid(),
'name' => $this->getName(),
'created' => $this->getCreated(),
2016-09-26 03:18:58 +08:00
'public_sharing_key' => $this->getPublicSharingKey(),
2016-09-11 19:07:39 +08:00
'last_access' => $this->getlastAccess(),
];
}
}