-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GridBundle] Impossible to create new Grid Driver #61
Comments
If someone get here is possible to do it but not easily. First into your class public const MY_API_DRIVER = 'my_vendor/my_api_driver';
public function getSupportedDrivers(): array
{
return [
self::MY_API_DRIVER,
SyliusResourceBundle::DRIVER_DOCTRINE_ORM
];
} Then an override have to be made into the
And finally the Custom After that you will be able to create your I would like to be able to create a |
Would the similar mechanism to the one from ThemeBundle work for you: https://docs.sylius.com/en/1.3/components_and_bundles/bundles/SyliusThemeBundle/configuration_sources/creating_custom.html? |
According to the doc, it requires a Bundle. Couldn't it be done without ? Symfony 4 advice to do everything in src without any bundle. |
@Roshyo You can register driver without a bundle with:
|
I don't think so since the list of allowed drivers is fixed in the vendor files. As described above |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions. |
This should be reopened and moved to grid repository. |
#61 (comment) has it right, you just need a service with the right DI tag and you should be fine. With that said... After a question in Slack this morning, I'm starting to wonder what the value is of the drivers config node in the first place. Reverse engineering the code, the bundle only uses it to "smartly" decide which grid driver services to load. There are better ways to decide whether services should be loaded, and with Sylius moving toward a Symfony 5.4 minimum requirement, the |
Sylius version affected: 1.x (I believe all of them, from the 1.0. 1.3 for sure)
Description
In order to fetch entities from an API and then display them in a grid, we have to create at least a new Driver and register it.
The thing is, when trying to register the new Driver in SyliusGrid, this exception is thrown :
The value "your/driver" is not allowed for path "sylius_resource.drivers.1". Permissible values: "doctrine/orm", "doctrine/mongodb-odm", "doctrine/phpcr-odm"
This is due to this in Sylius\Bundle\ResourceBundle\DependencyInjection\Configuration.php
So the first step is (do not reproduce at home) to override the availableDrivers and add our (all done in vendor...)
Then, in Sylius\Bundle\ResourceBundle\AbstractResourceBundle, there is a switch/case to also mpodify and add our new value.
Next step (nearly last one) we also have to override the switch/case in Sylius\Bundle\ResourceBundle\DependencyInjection\Driver\DriverProvider
And to finish, we are warned that the XML file of our provider does not exist. So we create a new one in
Sylius/resource-bundle/Resources/config/services/integration/your/driver.xml
Steps to reproduce
Install Sylius (GridBundle at least) and try to add a new Provider
Possible Solution
Be more permissive in this bundle configuration. It is just one step away from being able to fetch data in API and display them in a grid.
The text was updated successfully, but these errors were encountered: