aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Migration
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2024-07-29 10:14:29 -0100
committerMaxence Lange <maxence@artificial-owl.com>2024-07-29 12:44:52 -0100
commitad490c963bd88359a714fb2f1786aaf8c00ae17c (patch)
tree8dddff519102dbb73377fee762c91ff6792a1ad5 /lib/private/Migration
parent7c1ee524be784bf54d4c09d1310c182593d8b2f2 (diff)
downloadnextcloud-server-ad490c963bd88359a714fb2f1786aaf8c00ae17c.tar.gz
nextcloud-server-ad490c963bd88359a714fb2f1786aaf8c00ae17c.zip
feat(migration-attributes): tests
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/private/Migration')
-rw-r--r--lib/private/Migration/MetadataManager.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/Migration/MetadataManager.php b/lib/private/Migration/MetadataManager.php
index 2558d49f7f8..402252d6a46 100644
--- a/lib/private/Migration/MetadataManager.php
+++ b/lib/private/Migration/MetadataManager.php
@@ -36,7 +36,7 @@ class MetadataManager {
*
* @param string $appId
*
- * @return array
+ * @return array<string, MigrationAttribute[]>
* @since 30.0.0
*/
public function extractMigrationAttributes(string $appId): array {
@@ -48,7 +48,10 @@ class MetadataManager {
$class = new ReflectionClass($ms->createInstance($version));
$attributes = $class->getAttributes();
foreach ($attributes as $attribute) {
- $metadata[$version][] = $attribute->newInstance();
+ $item = $attribute->newInstance();
+ if ($item instanceof MigrationAttribute) {
+ $metadata[$version][] = $item;
+ }
}
}
@@ -144,7 +147,7 @@ class MetadataManager {
}
try {
- $attribute = new $class();
+ $attribute = new $class($item['table'] ?? '');
return $attribute->import($item);
} catch (\Error) {
throw new AttributeException('cannot import Attribute');