-
Notifications
You must be signed in to change notification settings - Fork 13
Ukol 3 - Jan Suchánek #34
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
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bacha tady, změnil jsi indent na mezery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oj ok, díky
* @param Request $request | ||
* @return RedirectResponse|array | ||
*/ | ||
public function editAction(Request $request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
* @ORM\Column(type="string", length=255, unique=false, name="surName") | ||
* @Assert\NotBlank() | ||
*/ | ||
private $surName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
když už tak lastName
. Surname je jedno slovo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok špatné názvosloví, díky.
@@ -23,6 +23,12 @@ class User implements UserInterface | |||
*/ | |||
private $id; | |||
|
|||
/** | |||
* @var Address | |||
* @ORM\ManyToOne(targetEntity="Address") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
$builder | ||
->add("firstName", EmailType::class, [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rozházená indentace proti zbytku kódu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ach jo, přitom jsem používal PHPStorm. Zkusím se polepšit.
Add simple insert address form for user