Closed mitjarobic closed 8 years ago
@jee7 can you answer this question?
Of course. You see, the UploadableExtensionServiceProvider registers a singleton with the alias of the class name of UploadableListener.
You can use that to fetch the singleton anywhere in your code (or inject it as an hard dependency if you want).
Using the app()
shortcut:
$listener = app(UploadableListener::class);
Thank you, but i can not get it to work. Is there something else I should set in doctrine.php except uncomment the 'LaravelDoctrine\Extensions\Uploadable\UploadableExtension::class' which is missing by default.
It seems the $this->fileInfoObjects is empty in onFlush method
although i set it with
$listener->addEntityFileInfo($file, new CustomFileInfo('/path/to/file.txt'));
Did you add the LaravelDoctrine\Extensions\Uploadable\UploadableExtensionServiceProvider::class
to the list of service providers (the providers
key) in your app.php
config?
That was it, thank you!
Btw, there is also an Uploadable facade that you can use. See my last comment in the PR.
You're welcome. Don't know, why the service provider registration seems to be missing from the doc.
Seems like the docs weren't updated after your PR. Could you make a PR with some notes about the singleton?
Hello,
i am trying to use the uploadable extension. How do i get the $listener variable used in the documentation example?