mirror of
https://github.com/nextcloud/passman.git
synced 2024-11-12 02:52:35 +08:00
58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
|
<?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 void setId(integer $value)
|
||
|
* @method integer getId()
|
||
|
* @method void setGuid(string $value)
|
||
|
* @method string getGuid()
|
||
|
* @method void setCredentialId(integer $value)
|
||
|
* @method string getCredentialId()
|
||
|
* @method void setUserId(string $value)
|
||
|
* @method string getUserid()
|
||
|
* @method void setCreated(integer $value)
|
||
|
* @method integer getCreated()
|
||
|
* @method void setCredentialData(string $value)
|
||
|
* @method string getCredentialData()
|
||
|
*/
|
||
|
class CredentialRevision extends Entity implements \JsonSerializable {
|
||
|
|
||
|
use EntityJSONSerializer;
|
||
|
|
||
|
protected $guid;
|
||
|
protected $credentialId;
|
||
|
protected $userId;
|
||
|
protected $created;
|
||
|
protected $credentialData;
|
||
|
|
||
|
|
||
|
public function __construct() {
|
||
|
// add types in constructor
|
||
|
$this->addType('created', 'integer');
|
||
|
$this->addType('credentialId', 'integer');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Turns entity attributes into an array
|
||
|
*/
|
||
|
public function jsonSerialize() {
|
||
|
return [
|
||
|
'revision_id' => $this->getId(),
|
||
|
'guid' => $this->getGuid(),
|
||
|
'created' => $this->getCreated(),
|
||
|
'credential_data' => unserialize(base64_decode($this->getCredentialData())),
|
||
|
];
|
||
|
}
|
||
|
}
|