Skip to content

Ukol 3 - Jan Suchánek#34

Open
JanSuchanek wants to merge 7 commits intoczcodecamp:masterfrom
JanSuchanek:master
Open

Ukol 3 - Jan Suchánek#34
JanSuchanek wants to merge 7 commits intoczcodecamp:masterfrom
JanSuchanek:master

Conversation

@JanSuchanek
Copy link
Copy Markdown

Add simple insert address form for user

@JanSuchanek
Copy link
Copy Markdown
Author

JanSuchanek commented Oct 23, 2016

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)
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Author

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)
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Author

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")
Copy link
Copy Markdown
Member

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;
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Author

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.


/**
* @var Address
* @ORM\ManyToOne(targetEntity="Address")
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Author

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, [
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants