-
Notifications
You must be signed in to change notification settings - Fork 13
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
Ukol 3 - Jan Suchánek #34
Open
JanSuchanek
wants to merge
7
commits into
czcodecamp:master
Choose a base branch
from
JanSuchanek:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
66ba5d3
Add insert address form
JanSuchanek 15389d9
Repar tabs on UserController.php
JanSuchanek 29d2c29
Rename form and template for User Address
JanSuchanek d69d8fd
Rename params for Address first & lastName
JanSuchanek c4b4cc4
Change space to tabs & replace ManyToOne to OneToMany on User Entity
JanSuchanek cb3680c
Change space to tabs on UserEditFormType
JanSuchanek 01f78ce
Change from Address Entity to User Entity on RegistrationFormType
JanSuchanek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% extends 'base.html.twig' %} | ||
|
||
{% block body %} | ||
<h1>Přidat adresu uživatele</h1> | ||
{{ form_start(form) }} | ||
{{ form_row(form.firstName) }} | ||
{{ form_row(form.lastName) }} | ||
{{ form_row(form.street) }} | ||
{{ form_row(form.city) }} | ||
{{ form_row(form.zip) }} | ||
<br /> | ||
<button class="btn btn-lg btn-primary btn-block" type="submit">Přidat</button> | ||
{{ form_end(form) }} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<?php | ||
namespace AppBundle\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | ||
|
||
/** | ||
* @author Vašek Boch <vasek.boch@live.com> | ||
* @author Jan Klat <jenik@klatys.cz> | ||
* | ||
* @ORM\Entity(repositoryClass="AppBundle\Repository\AddressRepository") | ||
* @ORM\Table(name="address") | ||
*/ | ||
class Address | ||
{ | ||
|
||
/** | ||
* @var int | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @ORM\Column(type="string", length=255, unique=false, name="firstName") | ||
* @Assert\NotBlank() | ||
*/ | ||
private $firstName; | ||
|
||
/** | ||
* @ORM\Column(type="string", length=255, unique=false, name="lastName") | ||
* @Assert\NotBlank() | ||
*/ | ||
private $lastName; | ||
|
||
/** | ||
* @ORM\Column(type="string", length=255, unique=false, name="street") | ||
* @Assert\NotBlank() | ||
*/ | ||
private $street; | ||
|
||
/** | ||
* @ORM\Column(type="string", length=255, unique=false, name="city") | ||
* @Assert\NotBlank() | ||
*/ | ||
private $city; | ||
|
||
/** | ||
* @ORM\Column(type="string", length=5, unique=false, name="zip") | ||
* @Assert\NotBlank() | ||
*/ | ||
private $zip; | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getFirstName() | ||
{ | ||
return $this->firstName; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getCity() | ||
{ | ||
return $this->city; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getLastName() | ||
{ | ||
return $this->lastName; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getStreet() | ||
{ | ||
return $this->street; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getZip() | ||
{ | ||
return $this->zip; | ||
} | ||
|
||
/** | ||
* @param mixed $city | ||
*/ | ||
public function setCity($city) | ||
{ | ||
$this->city = $city; | ||
} | ||
|
||
/** | ||
* @param mixed $firstName | ||
*/ | ||
public function setFirstName($firstName) | ||
{ | ||
$this->firstName = $firstName; | ||
} | ||
|
||
/** | ||
* @param mixed $street | ||
*/ | ||
public function setStreet($street) | ||
{ | ||
$this->street = $street; | ||
} | ||
|
||
/** | ||
* @param mixed $lastName | ||
*/ | ||
public function setLastName($lastName) | ||
{ | ||
$this->lastName = $lastName; | ||
} | ||
|
||
/** | ||
* @param mixed $zip | ||
*/ | ||
public function setZip($zip) | ||
{ | ||
$this->zip = $zip; | ||
} | ||
|
||
/** | ||
* @param int $id | ||
*/ | ||
public function setId($id) | ||
{ | ||
$this->id = $id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
namespace AppBundle\FormType; | ||
|
||
use AppBundle\Entity\Address; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\EmailType; | ||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | ||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
/** | ||
* @author Vašek Boch <vasek.boch@live.com> | ||
* @author Jan Klat <jenik@klatys.cz> | ||
*/ | ||
class UserEditFormType extends AbstractType | ||
{ | ||
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 commentThe 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 commentThe 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. |
||
"label" => "Jméno", | ||
"attr" => [ | ||
"class" => "form-control", | ||
], | ||
]) | ||
->add("surName", EmailType::class, [ | ||
"label" => "Příjmení", | ||
"attr" => [ | ||
"class" => "form-control", | ||
], | ||
]) | ||
->add("street", EmailType::class, [ | ||
"label" => "Ulice", | ||
"attr" => [ | ||
"class" => "form-control", | ||
], | ||
]) | ||
->add("city", EmailType::class, [ | ||
"label" => "Město", | ||
"attr" => [ | ||
"class" => "form-control", | ||
], | ||
]) | ||
->add("zip", EmailType::class, [ | ||
"label" => "PSČ", | ||
"attr" => [ | ||
"class" => "form-control", | ||
], | ||
]); | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver) | ||
{ | ||
$resolver->setDefaults(array( | ||
"data_class" => Address::class, | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace AppBundle\Repository; | ||
|
||
use Doctrine\ORM\EntityRepository; | ||
|
||
class AddressRepository extends EntityRepository | ||
{ | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 bylofirst_name
. Platí i pro ostatní sloupce