symfony4

Symfony Form with Doctrine Class Table Inheritance (CTI)

最后都变了- 提交于 2020-12-15 05:32:20
问题 In a previous question I ask how to handle large forms, outcome was Single Table Inheritance (STI) or CTI, Inheritance mapping. I've has chosen for CTI. Now i'm dealing how to create the form with CTI. A quick overview what kind or relation there are. Each inspection could have one or more surfaces . Each surface consists of many sub entities, like: surface_leakage , surface_tension or surface_slope . As you could see surface has the CTI with sub entities. Some fields overlap (put them in

Get the route name in a Symfony service [duplicate]

和自甴很熟 提交于 2020-12-13 03:45:07
问题 This question already has answers here : Getting the route name inside a service in symfony (2 answers) Closed 2 years ago . Im try to get the name of the current route in a Symfony 4 service. routes.yaml test-route: path: /test controller: App\Controller\Test::test service class Myservice { private $u; public function __construct(Utilities $u){ $this->u = $u; $route = getRouteSomehow(); // should return "test-route" } } I found this piece of code to grab the route: $requestStack-

Symfony 4 multiple entities in single form

泪湿孤枕 提交于 2020-12-08 12:44:40
问题 Been trying for hours and hours to get my multi entity form to work, but it really breaks my head and none of the examples I've found work. I checked the Collection form type documentation and form collections, as well as the Entity form type. I have a User entity, UserRole entity and a Role entity. UserRole contains a userID and a roleID. Just a linking table. The form shows fields to create a User and I want to be able to as well select a new Role for the new user. So I've tried to use the

Symfony 4 multiple entities in single form

余生长醉 提交于 2020-12-08 12:38:51
问题 Been trying for hours and hours to get my multi entity form to work, but it really breaks my head and none of the examples I've found work. I checked the Collection form type documentation and form collections, as well as the Entity form type. I have a User entity, UserRole entity and a Role entity. UserRole contains a userID and a roleID. Just a linking table. The form shows fields to create a User and I want to be able to as well select a new Role for the new user. So I've tried to use the

Symfony 4 multiple entities in single form

好久不见. 提交于 2020-12-08 12:38:41
问题 Been trying for hours and hours to get my multi entity form to work, but it really breaks my head and none of the examples I've found work. I checked the Collection form type documentation and form collections, as well as the Entity form type. I have a User entity, UserRole entity and a Role entity. UserRole contains a userID and a roleID. Just a linking table. The form shows fields to create a User and I want to be able to as well select a new Role for the new user. So I've tried to use the

Symfony 4 - Set DateTime

人走茶凉 提交于 2020-12-08 06:07:57
问题 so I've been following this Database and the Doctrine tutorial: https://symfony.com/doc/current/doctrine.html the only difference is that I added a created_ts field to it (among some other fields, but they work fine so no need to go into them). I used the make:entity command to generate my class and the method for setting my created_ts got generated like this: public function setCreatedTs(\DateTimeInterface $created_ts): self { $this->created_ts = $created_ts; return $this; } So in my /index

Symfony 4 - Set DateTime

試著忘記壹切 提交于 2020-12-08 06:07:30
问题 so I've been following this Database and the Doctrine tutorial: https://symfony.com/doc/current/doctrine.html the only difference is that I added a created_ts field to it (among some other fields, but they work fine so no need to go into them). I used the make:entity command to generate my class and the method for setting my created_ts got generated like this: public function setCreatedTs(\DateTimeInterface $created_ts): self { $this->created_ts = $created_ts; return $this; } So in my /index