Alana Storm
Alana Storm

Reputation: 166106

What is a "driver" in a Sylius Resource

This article mentions "drivers" in the context of a Sylius resource.

Remember that the doctrine/orm driver is used by default.

You can also configure several doctrine drivers.

sylius_resource:
    drivers:
        - doctrine/orm
        - doctrine/phpcr-odm

What exactly IS a driver. I understand, conceptually, this is telling Sylius what sort of model/orm layer my resource uses -- but what do the strings doctrine/orm actually do? Are they packagist packages? Class aliases that resolve to a PHP class name or prefix? Configuration keys for extra information configured elsewhere? Something else?

Upvotes: 1

Views: 194

Answers (1)

dbrumann
dbrumann

Reputation: 17166

It looks like it relates to the names of the corresponding composer packages and there are currently 3 available options:

See also: https://github.com/Sylius/SyliusResourceBundle/blob/master/src/Bundle/SyliusResourceBundle.php#L48-L55

In the future this might be reduced to just doctrine/orm, considering both odm drivers trigger a deprecation

As to what drivers do: A driver provides an ObjectManager and ObjectRepository for resources that will be mapped to the aliases manager and registry, if I see it correctly.

Upvotes: 1

Related Questions