0

I been searching for a solution to set the type of a routing in php.
In yml it can be done by:

_sonata_admin:
 resource: .
 type: sonata_admin
 prefix: /admin

In PHP I am importing it like so:

$routingImport = $loader->import(".");
$routingImport->addPrefix('/admin');
$collection->addCollection($routingImport );

It there a way to add a type parameter to this import like the one in yml?

1 Answer 1

1

The signature of the Symfony\Component\Config\Loader\FileLoader::$import method is:

public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null)

You can see that you can pass a type in the second argument:

$routingImport = $loader->import('.', 'sonata_admin');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.