Ukol 3 - Jan Suchánek#34
Ukol 3 - Jan Suchánek#34JanSuchanek wants to merge 7 commits intoczcodecamp:masterfrom JanSuchanek:master
Conversation
|
Vkládací formulář chci upravit ještě jako editační a připravit výpis více adres, tak aby se dali případně mazat. |
| "form" => $form->createView(), | ||
| ]; | ||
| } | ||
| // 2) handle the submit (will only happen on POST) |
There was a problem hiding this comment.
Bacha tady, změnil jsi indent na mezery
| * @param Request $request | ||
| * @return RedirectResponse|array | ||
| */ | ||
| public function editAction(Request $request) |
There was a problem hiding this comment.
Tady spíš logická - vlastně pokaždé přidáváš novou adresu. editAction tedy není zrovna vypovídající název
There was a problem hiding this comment.
Jasné, já sem ze začátku válčil jak to pojmenovat, máš pravdu.
| private $id; | ||
|
|
||
| /** | ||
| * @ORM\Column(type="string", length=255, unique=false, name="firstName") |
There was a problem hiding this comment.
tady jdeš proti zbytku projektu, sloupec v db se bude jmenovat firstName, přestože jinde by to bylo first_name. Platí i pro ostatní sloupce
src/AppBundle/Entity/Address.php
Outdated
| * @ORM\Column(type="string", length=255, unique=false, name="surName") | ||
| * @Assert\NotBlank() | ||
| */ | ||
| private $surName; |
There was a problem hiding this comment.
když už tak lastName. Surname je jedno slovo
There was a problem hiding this comment.
Ok špatné názvosloví, díky.
src/AppBundle/Entity/User.php
Outdated
|
|
||
| /** | ||
| * @var Address | ||
| * @ORM\ManyToOne(targetEntity="Address") |
There was a problem hiding this comment.
Tohle je bohužel špatně, ve formuláři přidáváš pokaždé novou adresu, tady připojuješ víc uživatelů k jedné adrese (což ani nedává smysl) správně by tato vazba měla být jako OneToMany
| public function buildForm(FormBuilderInterface $builder, array $options) | ||
| { | ||
| $builder | ||
| ->add("firstName", EmailType::class, [ |
There was a problem hiding this comment.
Rozházená indentace proti zbytku kódu
There was a problem hiding this comment.
Ach jo, přitom jsem používal PHPStorm. Zkusím se polepšit.
Add simple insert address form for user