K
K
kafkiansky2018-12-12 23:21:34
symfony
kafkiansky, 2018-12-12 23:21:34

Why doesn't the service work in Symfony 4.2?

Wrote a simple service for uploading files strictly according to this documentation https://symfony.com/doc/master/controller/upload_f... . However, Symfony throws an error

Cannot autowire service "App\Service\FileUploader": argument "$directory" of method "__construct()" has no type-hint, you should configure its value explicitly.

I understand that you need to specify the type, but what?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-12-12
@neliudov

services:
    App\Service\FileUploader:
        bind:
            $directory: 'uploads/posts'

not arguments, but bind

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question