[COMPONENT][Collection] Make MetaCollectionPlugin a trait and abstract collection delete and name update
This commit is contained in:
@@ -34,20 +34,24 @@ namespace Plugin\AttachmentCollections;
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Core\Router\RouteLoader;
|
||||
use App\Core\Router\Router;
|
||||
use App\Entity\Actor;
|
||||
use App\Entity\Feed;
|
||||
use App\Entity\LocalUser;
|
||||
use App\Util\Nickname;
|
||||
use Component\Collection\Util\MetaCollectionPlugin;
|
||||
use Component\Collection\Util\MetaCollectionTrait;
|
||||
use Plugin\AttachmentCollections\Controller\AttachmentCollections as AttachmentCollectionsController;
|
||||
use Plugin\AttachmentCollections\Entity\AttachmentCollection;
|
||||
use Plugin\AttachmentCollections\Entity\AttachmentCollectionEntry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class AttachmentCollections extends MetaCollectionPlugin
|
||||
class AttachmentCollections extends Plugin
|
||||
{
|
||||
use MetaCollectionTrait;
|
||||
protected string $slug = 'collection';
|
||||
protected string $plural_slug = 'collections';
|
||||
protected function createCollection(Actor $owner, array $vars, string $name)
|
||||
{
|
||||
$col = AttachmentCollection::create([
|
||||
|
@@ -77,4 +77,15 @@ class AttachmentCollections extends MetaCollectionController
|
||||
{
|
||||
return DB::findOneBy(AttachmentCollection::class, ['id' => $collection_id]);
|
||||
}
|
||||
|
||||
public function setCollectionName(int $actor_id, string $actor_nickname, AttachmentCollection $collection, string $name)
|
||||
{
|
||||
$collection->setName($name);
|
||||
DB::persist($collection);
|
||||
}
|
||||
|
||||
public function removeCollection(int $actor_id, string $actor_nickname, AttachmentCollection $collection)
|
||||
{
|
||||
DB::remove($collection);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user