-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Is it possible define form type in resource, when it is a service? #3843
Comments
@ufik You just define a service with same name, so |
Well I have defined it like this:
config
But it still doesn't work. @pjedrzejewski |
Not sure if you have noticed the last message @pjedrzejewski ? |
@ufik I did and will try to reproduce it today before tagging v0.16.0. 👍 I will get back to you soon. |
i'm doing this, works for me. |
@ufik Are you sure you are loading the definition after SyliusResourceBundle? |
@bendavies Can you please give an example, how do you use this? |
@pjedrzejewski Well you mean order of the bundles, right? We are loading our bundles after bundles from Sylius. |
@ufik looks the same as you, but i use xml
|
@ufik do you have proper order of resource importing in config file? imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: @SyliusCoreBundle/Resources/config/app/main.yml }
- { resource: resources.yml }
- { resource: services.yml } You should thing about keeping resource definition in a separated yaml file. |
@lchrusciel @pjedrzejewski Well I have configuration of the service in the bundle. And configuration of the resource is almost at the end of the config file... |
@ufik can you show your config file? |
Important is the zdg/eg.yml, where is definition of resources.
And finally in my bundle services.yml
|
can you |
@ufik I guess that |
@lchrusciel Even if I move my config before this configuration, the same. |
@bendavies And first command will not find the service, the second one will find the service. If you meant to have the same grep in pipe, like in the first one:) |
very hard to debug without the code. can you share a fork which replicates the issue? |
I am sorry, but I can't as it is code from our client and the source code is closed :/ |
I know it's hard and it's some stupid mistake somewhere in my code, I just can't see that, thanks a lot for all the suggestions, I guess I will need to give it a time and take a look later on. |
yes, but create a new project which replicates the issue |
@bendavies Here is the repo https://github.com/ufik/sylius-1
Here is controller with the form as a service, you need to submit form once to see resource in the backend. then go to To see edit form, which should show the same form as on the frontend, but showing default one instead. You will need to go to the roles and add Manage registrations to the Administrator role. |
Thanks. I'll take a look later |
What are the reproduction steps please? |
Described above... |
@ufik your form type name must match the alias. add to your
|
Thank you, such a stupid mistake. Sorry about this guys. |
No worries @ufik, this means we need better docs. Thanks! |
@pjedrzejewski actually, normally symfony would tell you this error if you tried to create the form with the form type name, but when sylius uses However, in #3762, we don't use |
@bendavies That's why I suggested registering it under the same service id, this way the generated form is replaced by custom definition and we do not have any error. :) |
Yep! Very good. |
I have form type, which uses db, so I defined this form as a service and in my controller I am getting this form type via $container->get(). And now I would like to define this form type in resource
But it's expecting only string, is there any way to do this?
The text was updated successfully, but these errors were encountered: