H
H
hiimnotwordy2018-06-08 19:24:05
symfony
hiimnotwordy, 2018-06-08 19:24:05

How to refer to Symfony4 directory path correctly?

I don't understand what to do with getParameter. Where to define it?

Attempted to call an undefined method named "getParameter" of class "App\Controller\UserController".

I connect according to the example symfony.com/doc/4.1/controller/upload_file.html
the path to the directory is written:
vich_uploader.yaml
vich_uploader:
    mappings:
        users:
            uri_prefix: /images/users
            upload_destination: '%kernel.project_dir%/public/images/users'

UserController.php
$file->move(
                $this->getParameter('upload_destination'), -- ошибка
                # '../public/images/users/',  -- ок
                $fileName
            );

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question