Chapters
40 Chapters
|
4:19:16
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
30.
Multiple Cruds for a Single Entity?
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
This tutorial is built on Symfony 6 but works great on Symfony 7!
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.2.0",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "^1.11", // 1.11.99.4
"doctrine/doctrine-bundle": "^2.1", // 2.5.5
"doctrine/doctrine-migrations-bundle": "^3.0", // 3.2.1
"doctrine/orm": "^2.7", // 2.10.4
"easycorp/easyadmin-bundle": "^4.0", // v4.0.2
"handcraftedinthealps/goodby-csv": "^1.4", // 1.4.0
"knplabs/knp-markdown-bundle": "dev-symfony6", // dev-symfony6
"knplabs/knp-time-bundle": "^1.11", // 1.17.0
"sensio/framework-extra-bundle": "^6.0", // v6.2.5
"stof/doctrine-extensions-bundle": "^1.4", // v1.7.0
"symfony/asset": "6.0.*", // v6.0.1
"symfony/console": "6.0.*", // v6.0.2
"symfony/dotenv": "6.0.*", // v6.0.2
"symfony/flex": "^2.0.0", // v2.4.5
"symfony/framework-bundle": "6.0.*", // v6.0.2
"symfony/mime": "6.0.*", // v6.0.2
"symfony/monolog-bundle": "^3.0", // v3.7.1
"symfony/runtime": "6.0.*", // v6.0.0
"symfony/security-bundle": "6.0.*", // v6.0.2
"symfony/stopwatch": "6.0.*", // v6.0.0
"symfony/twig-bundle": "6.0.*", // v6.0.1
"symfony/ux-chartjs": "^2.0", // v2.0.1
"symfony/webpack-encore-bundle": "^1.7", // v1.13.2
"symfony/yaml": "6.0.*", // v6.0.2
"twig/extra-bundle": "^2.12|^3.0", // v3.3.7
"twig/twig": "^2.12|^3.0" // v3.3.7
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.3", // 3.4.1
"symfony/debug-bundle": "6.0.*", // v6.0.2
"symfony/maker-bundle": "^1.15", // v1.36.4
"symfony/var-dumper": "6.0.*", // v6.0.2
"symfony/web-profiler-bundle": "6.0.*", // v6.0.2
"zenstruck/foundry": "^1.1" // v1.16.0
}
}
10 Comments
Now, I understand how to edit one entity with two controllers, but is there any way to edit two (one2one related) entities within one crud controller?
I have two entities (certificate ans testResults in a one2one relation) and I want to edit or add the test results together with the certificate.
Thank you for your help.
You could try dot notation as property name argument for new field in
configureFieldsmethod. (IDK, but I think there isPropertyAccessunder the hood):I've just tried, and I can change Topic name when editing Question. But I think there are some limitations exists. Maybe not.
Hey Klaus,
EasyAdmin relies on the Symfony Form component under the hood, so basically, you can do whatever you want as long as the Symfony Form component allows it. In this case, I think you'll need to set up an embedded form into the new/edit actions.
Cheers!
Hello, how can I add the "isApproved" field in the "QuestionPendingApprovalCrudController" crud and not in the "QuestionCrudController" crud. Basically get the fields from the "QuestionCrudController" but add the "isApproved" field.
Hey HR!
Since
QuestionPendingApprovalCrudControllerextendsQuestionCrudController, you could overrideconfigureFields()inQuestionPendingApprovalCrudController- something like this:Let me know if that works!
Cheers!
It works perfectly thanks weaverryan! I just replaced the
Field::new()withBooleanField::new()to have better functionality.Hi, is it possible to several CRUD operation on the same page. For example, edit values directly on the index page. It would be really convinient:
I have entities with only 1 text property
Hey Mofogasy,
Unfortunately, it's not possible out of the box, but I think you can write your custom code to achieve this, nothing is impossible :) You can take a look at the BooleanField and how it works - it allows you to edit boolean fields with a nice JS switcher right from the index page. I suppose you need to write something similar, though it will be a bit more complex as you would need also a text field for editing probably.
I hope this helps and good luck!
Cheers!
Hi ok , too bad as I would have used it for many pages.
Thanks!
Hey Mofogasy,
I think the bundle has other features with a higher priority, but feel free to contribute to the bundle if you want! :) But first, I'd recommend you discuss this feature in an issue.
Cheers!
"Houston: no signs of life"
Start the conversation!