1up-lab / OneupUploaderBundle

This Symfony bundle provides a server implementation for handling single and multiple file uploads using either FineUploader, jQuery File Uploader, YUI3 Uploader, Uploadify, FancyUpload, MooUpload, Plupload or Dropzone. Features include chunked uploads, orphanages, Gaufrette and Flysystem support.
MIT License
604 stars 177 forks source link

S6 : How to call OrphanageManager #428

Open PauchardThomas opened 2 years ago

PauchardThomas commented 2 years ago

Question

Hello, following the controller part from orphanage doc, i'm trying to acces to the OrphanageManager :

$manager = $this->get('oneup_uploader.orphanage_manager')->get('gallery');

However, $this->get('') not existing on AbstractController on Symfony6, and I cannot use DependencyInjection with Oneup\UploaderBundle\Uploader\Orphanage\OrphanageManager

How can I call the manager with S6 ?

Thnaks

Q A
Version 4.0
bytehead commented 2 years ago

and I cannot use DependencyInjection

Why not? Missing autoconfiguration/autowiring?

PauchardThomas commented 2 years ago

When I'm trying to inject Oneup\UploaderBundle\Uploader\Orphanage\OrphanageManager , here what's i'm getting : Cannot autowire argument $manager of "App\Controller\MyController::myfunction()": it references class "Oneup\UploaderBundle\Uploader\Orphanage\OrphanageManager" but no such service exists. You should maybe alias this class to the existing "oneup_uploader.orphanage_manager" service.

Here my conf :

# Read the documentation: https://github.com/1up-lab/OneupUploaderBundle/blob/master/Resources/doc/index.md
oneup_uploader:
    mappings:
        # This is a mapping example, remove it and create your own mappings.
        gallery:
            #use_orphanage: true
            frontend: dropzone # or any uploader you use in the frontend
            storage:
                directory: "%kernel.project_dir%/public/uploads/gallery/"
            use_orphanage: true
    chunks:
        maxage: 86400 # 24h
        storage:
            directory: "%kernel.cache_dir%/uploader/chunks"
    orphanage:
        maxage: 86400 # 24h
        directory: "%kernel.cache_dir%/uploader/orphanage"

Should I add something to my services.yaml ?

bytehead commented 2 years ago

Thanks for the feedback, I'll try to provide a fix! 👍

bytehead commented 2 years ago

Should I add something to my services.yaml ?

As a temporary fix you could add following to your services.yaml:

# config/services.yaml

services:
    # ... 
    # Alias
    Oneup\UploaderBundle\Uploader\Orphanage\OrphanageManager: "@oneup_uploader.orphanage_manager"
    # ...