]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: Adjust Entity types feat/add-datetime-qbmapper-support 47329/head
authorFerdinand Thiessen <opensource@fthiessen.de>
Thu, 19 Sep 2024 13:46:20 +0000 (15:46 +0200)
committerFerdinand Thiessen <opensource@fthiessen.de>
Thu, 17 Oct 2024 16:31:44 +0000 (18:31 +0200)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
apps/contactsinteraction/lib/Db/RecentContact.php
apps/dav/lib/CalDAV/Proxy/Proxy.php
apps/dav/lib/Db/Direct.php
apps/oauth2/lib/Db/AccessToken.php
apps/oauth2/lib/Db/Client.php
apps/user_status/lib/Db/UserStatus.php
core/Db/LoginFlowV2.php
lib/private/Authentication/Token/PublicKeyToken.php
lib/private/Updater/Changes.php
lib/public/AppFramework/Db/Entity.php

index 581b4b292ca0be455ed1ea0d89f901981233a04c..fc6ec3cc249817f431301fcd6087f5c788146f1c 100644 (file)
@@ -9,6 +9,7 @@ declare(strict_types=1);
 namespace OCA\ContactsInteraction\Db;
 
 use OCP\AppFramework\Db\Entity;
+use OCP\DB\Types;
 
 /**
  * @method void setActorUid(string $uid)
@@ -33,11 +34,11 @@ class RecentContact extends Entity {
        protected int $lastContact = -1;
 
        public function __construct() {
-               $this->addType('actorUid', 'string');
-               $this->addType('uid', 'string');
-               $this->addType('email', 'string');
-               $this->addType('federatedCloudId', 'string');
-               $this->addType('card', 'blob');
-               $this->addType('lastContact', 'int');
+               $this->addType('actorUid', Types::STRING);
+               $this->addType('uid', Types::STRING);
+               $this->addType('email', Types::STRING);
+               $this->addType('federatedCloudId', Types::STRING);
+               $this->addType('card', Types::BLOB);
+               $this->addType('lastContact', Types::INTEGER);
        }
 }
index a10f82e4b29d31623c097758deec579cd47b0134..ef1ad8c634f882a97ca86b9cd2cbcda0071ff29e 100644 (file)
@@ -9,6 +9,7 @@ declare(strict_types=1);
 namespace OCA\DAV\CalDAV\Proxy;
 
 use OCP\AppFramework\Db\Entity;
+use OCP\DB\Types;
 
 /**
  * @method string getOwnerId()
@@ -28,8 +29,8 @@ class Proxy extends Entity {
        protected $permissions;
 
        public function __construct() {
-               $this->addType('ownerId', 'string');
-               $this->addType('proxyId', 'string');
-               $this->addType('permissions', 'int');
+               $this->addType('ownerId', Types::STRING);
+               $this->addType('proxyId', Types::STRING);
+               $this->addType('permissions', Types::INTEGER);
        }
 }
index 377a120c436494b31a42ea24c5439db54c8f90b7..4e4a12d225f546edc17f16cc47908bc877af5b8e 100644 (file)
@@ -9,6 +9,7 @@ declare(strict_types=1);
 namespace OCA\DAV\Db;
 
 use OCP\AppFramework\Db\Entity;
+use OCP\DB\Types;
 
 /**
  * @method string getUserId()
@@ -34,9 +35,9 @@ class Direct extends Entity {
        protected $expiration;
 
        public function __construct() {
-               $this->addType('userId', 'string');
-               $this->addType('fileId', 'int');
-               $this->addType('token', 'string');
-               $this->addType('expiration', 'int');
+               $this->addType('userId', Types::STRING);
+               $this->addType('fileId', Types::INTEGER);
+               $this->addType('token', Types::STRING);
+               $this->addType('expiration', Types::INTEGER);
        }
 }
index 543d512e0ce35363f6dcc6a8878479ee31009812..f9c0e6de51e6f0a84ba02ff9c8474cd7b20c03c3 100644 (file)
@@ -6,6 +6,7 @@
 namespace OCA\OAuth2\Db;
 
 use OCP\AppFramework\Db\Entity;
+use OCP\DB\Types;
 
 /**
  * @method int getTokenId()
@@ -36,12 +37,12 @@ class AccessToken extends Entity {
        protected $tokenCount;
 
        public function __construct() {
-               $this->addType('id', 'int');
-               $this->addType('tokenId', 'int');
-               $this->addType('clientId', 'int');
+               $this->addType('id', Types::INTEGER);
+               $this->addType('tokenId', Types::INTEGER);
+               $this->addType('clientId', Types::INTEGER);
                $this->addType('hashedCode', 'string');
                $this->addType('encryptedToken', 'string');
-               $this->addType('codeCreatedAt', 'int');
-               $this->addType('tokenCount', 'int');
+               $this->addType('codeCreatedAt', Types::INTEGER);
+               $this->addType('tokenCount', Types::INTEGER);
        }
 }
index c48ca4edfc0dcfa901de1f86ec256db5b6c36e83..458d85b24ab251f17d8bbc78338d3296d82f79df 100644 (file)
@@ -6,6 +6,7 @@
 namespace OCA\OAuth2\Db;
 
 use OCP\AppFramework\Db\Entity;
+use OCP\DB\Types;
 
 /**
  * @method string getClientIdentifier()
@@ -28,7 +29,7 @@ class Client extends Entity {
        protected $secret;
 
        public function __construct() {
-               $this->addType('id', 'int');
+               $this->addType('id', Types::INTEGER);
                $this->addType('name', 'string');
                $this->addType('redirectUri', 'string');
                $this->addType('clientIdentifier', 'string');
index 1be358308532d399757f551137be7347e02c3c74..b2da4a9e07a9151978c41283dbb1221071892906 100644 (file)
@@ -9,6 +9,7 @@ declare(strict_types=1);
 namespace OCA\UserStatus\Db;
 
 use OCP\AppFramework\Db\Entity;
+use OCP\DB\Types;
 
 /**
  * Class UserStatus
@@ -73,13 +74,13 @@ class UserStatus extends Entity {
        public function __construct() {
                $this->addType('userId', 'string');
                $this->addType('status', 'string');
-               $this->addType('statusTimestamp', 'int');
+               $this->addType('statusTimestamp', Types::INTEGER);
                $this->addType('isUserDefined', 'boolean');
                $this->addType('messageId', 'string');
                $this->addType('customIcon', 'string');
                $this->addType('customMessage', 'string');
-               $this->addType('clearAt', 'int');
+               $this->addType('clearAt', Types::INTEGER);
                $this->addType('isBackup', 'boolean');
-               $this->addType('statusMessageTimestamp', 'int');
+               $this->addType('statusMessageTimestamp', Types::INTEGER);
        }
 }
index 90b6f41a626abc9de5c50bec7d2a710ca5a0d7b9..1671e5990e04fc7352ee19e16e6c18bdcc4394fa 100644 (file)
@@ -9,6 +9,7 @@ declare(strict_types=1);
 namespace OC\Core\Db;
 
 use OCP\AppFramework\Db\Entity;
+use OCP\DB\Types;
 
 /**
  * @method int getTimestamp()
@@ -55,8 +56,8 @@ class LoginFlowV2 extends Entity {
        protected $appPassword;
 
        public function __construct() {
-               $this->addType('timestamp', 'int');
-               $this->addType('started', 'int');
+               $this->addType('timestamp', Types::INTEGER);
+               $this->addType('started', Types::INTEGER);
                $this->addType('pollToken', 'string');
                $this->addType('loginToken', 'string');
                $this->addType('publicKey', 'string');
index 961b7191d84ae76bb38ebd7a72443ee055cdd18c..be427ab48392a36905aadac6b43545792b7762b6 100644 (file)
@@ -10,6 +10,7 @@ namespace OC\Authentication\Token;
 
 use OCP\AppFramework\Db\Entity;
 use OCP\Authentication\Token\IToken;
+use OCP\DB\Types;
 
 /**
  * @method void setId(int $id)
@@ -88,16 +89,16 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken {
                $this->addType('passwordHash', 'string');
                $this->addType('name', 'string');
                $this->addType('token', 'string');
-               $this->addType('type', 'int');
-               $this->addType('remember', 'int');
-               $this->addType('lastActivity', 'int');
-               $this->addType('lastCheck', 'int');
+               $this->addType('type', Types::INTEGER);
+               $this->addType('remember', Types::INTEGER);
+               $this->addType('lastActivity', Types::INTEGER);
+               $this->addType('lastCheck', Types::INTEGER);
                $this->addType('scope', 'string');
-               $this->addType('expires', 'int');
+               $this->addType('expires', Types::INTEGER);
                $this->addType('publicKey', 'string');
                $this->addType('privateKey', 'string');
-               $this->addType('version', 'int');
-               $this->addType('passwordInvalid', 'bool');
+               $this->addType('version', Types::INTEGER);
+               $this->addType('passwordInvalid', Types::BOOLEAN);
        }
 
        public function getId(): int {
index bdf799a01006a4101ae02b0dadd25ebe0c0bcd66..c941dfb3fa56887adc808f6f024c7553ba792b0c 100644 (file)
@@ -9,6 +9,7 @@ declare(strict_types=1);
 namespace OC\Updater;
 
 use OCP\AppFramework\Db\Entity;
+use OCP\DB\Types;
 
 /**
  * Class Changes
@@ -39,7 +40,7 @@ class Changes extends Entity {
        public function __construct() {
                $this->addType('version', 'string');
                $this->addType('etag', 'string');
-               $this->addType('lastCheck', 'int');
+               $this->addType('lastCheck', Types::INTEGER);
                $this->addType('data', 'string');
        }
 }
index 882902a212e4d9d94c48abc5c30e287c416302cf..cd15df134f1bd3f28aca91644846b2b0acef4225 100644 (file)
@@ -15,7 +15,6 @@ use function substr;
 /**
  * @method int getId()
  * @method void setId(int $id)
- * @psalm-type AllowedTypes = 'json'|'blob'|'datetime'|'string'|'int'|'integer'|'bool'|'boolean'|'float'|'double'|'array'|'object'
  * @since 7.0.0
  * @psalm-consistent-constructor
  */
@@ -26,7 +25,7 @@ abstract class Entity {
        public $id;
 
        private array $_updatedFields = [];
-       /** @var array<string, AllowedTypes> */
+       /** @var array<string, \OCP\DB\Types::*> */
        private array $_fieldTypes = ['id' => 'integer'];
 
        /**
@@ -67,7 +66,7 @@ abstract class Entity {
 
 
        /**
-        * @return array<string, AllowedTypes> with attribute and type
+        * @return array<string, \OCP\DB\Types::*> with attribute and type
         * @since 7.0.0
         */
        public function getFieldTypes(): array {
@@ -260,7 +259,7 @@ abstract class Entity {
         * that value once its being returned from the database
         *
         * @param string $fieldName the name of the attribute
-        * @param AllowedTypes $type the type which will be used to match a cast
+        * @param \OCP\DB\Types::* $type the type which will be used to match a cast
         * @since 7.0.0
         */
        protected function addType(string $fieldName, string $type): void {