mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-11-24 21:50:26 +01:00
save fileId for folder resources
This commit is contained in:
parent
92c431e856
commit
82d95da322
3 changed files with 9 additions and 1 deletions
|
@ -6,12 +6,14 @@ class FolderResource extends Resource {
|
|||
protected $membersAclPermission;
|
||||
protected $managersAclPermission;
|
||||
protected $inheritedAclPermission;
|
||||
protected $fileId;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->addType('membersAclPermission','integer');
|
||||
$this->addType('managersAclPermission','integer');
|
||||
$this->addType('inheritedAclPermission','integer');
|
||||
$this->addType('fileId','integer');
|
||||
}
|
||||
|
||||
public static function fromRow(array $row): static {
|
||||
|
@ -26,6 +28,7 @@ class FolderResource extends Resource {
|
|||
$instance->setMembersAclPermission($row["members_acl_permission"]);
|
||||
$instance->setManagersAclPermission($row["managers_acl_permission"]);
|
||||
$instance->setInheritedAclPermission($row["inherited_acl_permission"]);
|
||||
$instance->setFileId($row["file_id"]);
|
||||
|
||||
$instance->resetUpdatedFields();
|
||||
|
||||
|
@ -45,6 +48,7 @@ class FolderResource extends Resource {
|
|||
'membersAclPermission' => $this->membersAclPermission,
|
||||
'managersAclPermission' => $this->managersAclPermission,
|
||||
'inheritedAclPermission' => $this->inheritedAclPermission,
|
||||
'fileId' => $this->fileId,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class ResourceMapper extends QBMapper {
|
|||
public const FOLDER_RESOURCES_TABLE = "organizationfolders_folder_resources";
|
||||
|
||||
private const updateableResourceProperties = ["parentResource", "active", "name", "lastUpdatedTimestamp"];
|
||||
private const updateableFolderResourceProperties = ["membersAclPermission", "managersAclPermission", "inheritedAclPermission"];
|
||||
private const updateableFolderResourceProperties = ["membersAclPermission", "managersAclPermission", "inheritedAclPermission", "fileId"];
|
||||
|
||||
public function __construct(IDBConnection $db) {
|
||||
parent::__construct($db, self::RESOURCES_TABLE, Resource::class);
|
||||
|
|
|
@ -89,6 +89,9 @@ class Version000000Date20241014120000 extends SimpleMigrationStep {
|
|||
'length' => 11,
|
||||
'notnull' => true,
|
||||
]);
|
||||
$table->addColumn('file_id', Types::INTEGER, [
|
||||
'notnull' => true,
|
||||
]);
|
||||
|
||||
$table->setPrimaryKey(['resource_id']);
|
||||
$table->addForeignKeyConstraint(
|
||||
|
@ -97,6 +100,7 @@ class Version000000Date20241014120000 extends SimpleMigrationStep {
|
|||
['id'],
|
||||
['onDelete' => 'CASCADE'],
|
||||
'organizationfolders_folder_resources_resource_id_fk');
|
||||
$table->addIndex(['file_id'], 'organizationfolders_folder_resources_file_id_index');
|
||||
}
|
||||
|
||||
return $schema;
|
||||
|
|
Loading…
Reference in a new issue