File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747 * @method string getEtag() Get the etag of the preview.
4848 * @method void setEtag(string $etag)
4949 * @method string|null getVersion() Get the version for files_versions_s3
50- * @method void setVersionId(string $versionId)
50+ * @method string|null getVersionId() Get the ID of the version metadata row.
51+ * @method void setVersionId(string $versionId) Set the ID of the version metadata row.
5152 * @method bool|null getIs() Get the version for files_versions_s3
5253 * @method bool isEncrypted() Get whether the preview is encrypted. At the moment every preview is unencrypted.
5354 * @method void setEncrypted(bool $encrypted)
Original file line number Diff line number Diff line change @@ -84,11 +84,15 @@ public function update(Entity $entity): Entity {
8484 public function delete (Entity $ entity ): Entity {
8585 /** @var Preview $preview */
8686 $ preview = $ entity ;
87- if ($ preview ->getVersion () !== null && $ preview ->getVersion () !== '' ) {
87+
88+ $ versionId = $ preview ->getVersionId ();
89+ if ($ versionId !== null && $ versionId !== '' && $ versionId !== '-1 ' ) {
8890 $ qb = $ this ->db ->getQueryBuilder ();
8991 $ qb ->delete (self ::VERSION_TABLE_NAME )
90- ->where ($ qb ->expr ()->eq ('file_id ' , $ qb ->createNamedParameter ($ preview ->getFileId ())))
91- ->andWhere ($ qb ->expr ()->eq ('version ' , $ qb ->createNamedParameter ($ preview ->getVersion ())))
92+ ->where ($ qb ->expr ()->eq (
93+ 'id ' ,
94+ $ qb ->createNamedParameter ($ versionId ),
95+ ))
9296 ->executeStatement ();
9397 }
9498
You can’t perform that action at this time.
0 commit comments