-
-
Notifications
You must be signed in to change notification settings - Fork 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
Issue with CollectionField and useEntryCrudForm in EasyAdminBundle #5995
Comments
Maybe just copy paste the configurations in the ticket directly. 👀 |
I added the configuration of AdminCrud for Post and Comment. I'm sure this is a bug because if I comment the option to configure fields in a comment, the fields in the form that apply to the parent class appear. In my case the Post class. I can configure the fields and everything saves fine. Unfortunately, I cannot affect other properties of the Comment class. I'm trying to put dd() in the createEntity(), updateEntity() functions but it seems I can't refer to it if the collection field is created in the Post class. |
Should be easy to fix, let me have a look real quick as I am just working with the CollectionField at the moment anyway. |
I have made a simple adaption in the PR above, but I'd kindly ask you to modify your local code base respectively and give feedback to me so I know if thats fixing your issue. Also, 6000th PR in this project. :D |
Unfortunately, if I set a name in a new object, I still don't see it in the collection.
Nothing appears The only change is that if I use the dd() method in this field, the result from this method appears on the screen. |
So its more of an initialization issue of the form itself, as the value is being passed on (observable trough xdebug). When I find more time I can check it again. |
Any chance to get this fixed? I have a similar issue: |
Same problem here, I get a "An exception occurred while executing a query: Column '' cannot be null", field is initialized in the createEntity() method of the CRUD referenced by a CollectionField. |
Describe the bug
Related Entity Fields Retrieval:
In the current implementation, if the fields for the related entity (e.g., Comment) are not defined explicitly in the configureFields() function of the related CRUD controller (CommentCrudController), the fields are automatically inherited from the current CRUD controller (PostCrudController). This behavior leads to unexpected field inheritance and requires explicit definition of fields in the related CRUD controller, even if they are intended to be different.
Initial Values in CollectionField:
When attempting to set specific initial values for fields in the related entity (e.g., setting the type field to "TEST" when creating a new comment), the specified initial values are not reflected in the CollectionField. While the initial values work correctly when creating the entity through its CRUD form, the same values are not propagated to the CollectionField. This inconsistency creates difficulties in maintaining uniform data across related entities within the collection.
To Reproduce
Expected Behavior
Actual Behavior
(OPTIONAL) Additional context
EasyAdmin-bundle: 4.8.3
Symfony: 6.3.7
PHP: 8.2.10
Thank you for your attention to this issue. Please let me know if you need any further information or clarification.
Code configuration of PostCrudController.php and CommentCrudController.php:
Below images of admin dashboard for Post and Comment. In Post->Comment Collections I expected added comment with type "TEST". Unfortunately i have null value :/
Below attached src code with example.
src.zip
The text was updated successfully, but these errors were encountered: