[Attachment] Move Controller and Entities to a Component

There's no problem in having the templates in the core
This commit is contained in:
2021-12-02 15:12:31 +00:00
parent 37ef8cddfa
commit eeaad19754
22 changed files with 37 additions and 48 deletions

View File

@@ -35,7 +35,7 @@ public static function getAvatarFileInfo(int $gsactor_id): array
Cache::get("avatar-file-info-{$gsactor_id}",
function () use ($gsactor_id) {
return DB::dql('select f.file_hash, f.mimetype, f.title ' .
'from App\Entity\Attachment f ' .
'from Component\Attachment\Entity\Attachment f ' .
'join App\Entity\Avatar a with f.id = a.attachment_id ' .
'where a.gsactor_id = :gsactor_id',
['gsactor_id' => $gsactor_id]);

View File

@@ -68,7 +68,7 @@ Simple enough.
### Attachments: Storing a reference in database
Finally, you need a way to refer to previous files.
GNU social calls that representation of `App\Entity\Attachment`.
GNU social calls that representation of `Component\Attachment\Entity\Attachment`.
If a note refers to an `Attachment` then you can link them
using the entity `AttachmentToNote`.
@@ -97,7 +97,7 @@ can be generated from files. And `StoreRemoteMedia` to understand how to generat
them from URLs.
The controller asking for them is the `App\Controller\Attachment::attachment_thumbnail` with
a call to `App\Entity\AttachmentThumbnail::getOrCreate()`.
a call to `Component\Attachment\Entity\AttachmentThumbnail::getOrCreate()`.
## Trade-offs between decoupling and complexity