Can I reach "/ web" path from container in Symfony2?
I need to save a file in a path /web/import
and I ask what is the best way for it. I have a class defined in /Service/SyncController.php
and it extends from Controller
:
class SyncController extends Controller { ... }
This class is also defined as a service:
sync.service:
class: PDI\PDOneBundle\Service\SyncController
arguments: ["@service_container", "@doctrine.orm.entity_manager", "@request_stack", "%kernel.root_dir%"]
Do I need to pass an argument "%kernel.root_dir%"
to access the web path like $this->webRoot = realpath($rootDir . '/../web')
or can I do it with @service_container
? What is the correct way to get the path to /web/import
in order to save the files there?
source to share