-
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 - Tomáš Linhart #31
Open
tomeus
wants to merge
4
commits into
czcodecamp:master
Choose a base branch
from
tomeus:homework_3
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 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f373d32
Ukol 3 - Tomas Linhart: prepare entities and basic repositories
aeb9672
Ukol 3 - Tomas Linhart: refactoring entity for user and registration …
d691c1f
Ukol 3 - Tomas Linhart: refacroting users routes and pages, prepare a…
4b46303
Ukol 3 - Tomas Linhart: could add addresses for user
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
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,46 @@ | ||
<?php | ||
namespace AppBundle\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @author Tomáš Linhart <[email protected]> | ||
* | ||
* @ORM\Entity(repositoryClass="AppBundle\Repository\AddressRepository") | ||
*/ | ||
class Address | ||
{ | ||
|
||
/** | ||
* @var int | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @var string | ||
* @ORM\Column(type="string") | ||
*/ | ||
private $name; | ||
|
||
/** | ||
* @var string | ||
* @ORM\Column(type="string") | ||
*/ | ||
private $city; | ||
|
||
/** | ||
* @var string | ||
* @ORM\Column(type="string") | ||
*/ | ||
private $street; | ||
|
||
/** | ||
* @var int | ||
* @ORM\Column(type="integer") | ||
*/ | ||
private $zip; | ||
|
||
} |
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 |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
* @author Vašek Boch <[email protected]> | ||
* @author Jan Klat <[email protected]> | ||
* @ORM\Entity | ||
* @UniqueEntity(fields="username", message="Tento e-mail je již registrován") | ||
* @UniqueEntity(fields="username", message="Toto uživatelské jméno je již registrováno") | ||
*/ | ||
class User implements UserInterface | ||
{ | ||
|
@@ -24,23 +24,47 @@ class User implements UserInterface | |
private $id; | ||
|
||
/** | ||
* @ORM\Column(type="string", length=255, unique=true, name="email") | ||
* @var string | ||
* @ORM\Column(type="string", length=255, unique=true, name="username") | ||
* @Assert\NotBlank() | ||
* @Assert\Email() | ||
* @Assert\Blank(groups={"passwordReset"}) | ||
*/ | ||
private $username; | ||
|
||
/** | ||
* @var string | ||
* @ORM\Column(type="string", length=64) | ||
* @Assert\NotBlank(groups={"profileSetup"}) | ||
*/ | ||
private $password; | ||
|
||
/** | ||
* @var string | ||
* @Assert\NotBlank() | ||
* @Assert\Length(max=4096) | ||
*/ | ||
private $plainPassword; | ||
|
||
/** | ||
* @var string | ||
* @ORM\Column(type="string", length=255, name="name", nullable=true) | ||
*/ | ||
private $name; | ||
|
||
/** | ||
* @var string | ||
* @ORM\Column(type="string", length=255, unique=true, name="email", nullable=true) | ||
* @Assert\Email() | ||
*/ | ||
private $email; | ||
|
||
/** | ||
* @var string | ||
* @ORM\Column(type="string", length=255, unique=true, name="phone", nullable=true) | ||
* @Assert\Email() | ||
*/ | ||
private $phone; | ||
|
||
/** | ||
* @return int | ||
*/ | ||
|
@@ -60,15 +84,15 @@ public function setId($id) | |
} | ||
|
||
/** | ||
* @return mixed | ||
* @return string | ||
*/ | ||
public function getUsername() | ||
{ | ||
return $this->username; | ||
} | ||
|
||
/** | ||
* @param mixed $username | ||
* @param string $username | ||
* @return self | ||
*/ | ||
public function setUsername($username) | ||
|
@@ -78,15 +102,15 @@ public function setUsername($username) | |
} | ||
|
||
/** | ||
* @return mixed | ||
* @return string | ||
*/ | ||
public function getPassword() | ||
{ | ||
return $this->password; | ||
} | ||
|
||
/** | ||
* @param mixed $password | ||
* @param string $password | ||
* @return self | ||
*/ | ||
public function setPassword($password) | ||
|
@@ -96,15 +120,15 @@ public function setPassword($password) | |
} | ||
|
||
/** | ||
* @return mixed | ||
* @return string | ||
*/ | ||
public function getPlainPassword() | ||
{ | ||
return $this->plainPassword; | ||
} | ||
|
||
/** | ||
* @param mixed $plainPassword | ||
* @param string $plainPassword | ||
* @return self | ||
*/ | ||
public function setPlainPassword($plainPassword) | ||
|
@@ -129,4 +153,60 @@ public function eraseCredentials() | |
return; | ||
} | ||
|
||
// profile specification | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* @return self | ||
*/ | ||
public function setName($name) | ||
{ | ||
$this->name = $name; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getEmail() | ||
{ | ||
return $this->email; | ||
} | ||
|
||
/** | ||
* @param string $email | ||
* @return self | ||
*/ | ||
public function setEmail($email) | ||
{ | ||
$this->email = $email; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPhone() | ||
{ | ||
return $this->phone; | ||
} | ||
|
||
/** | ||
* @param string $phone | ||
* @return self | ||
*/ | ||
public function setPhone($phone) | ||
{ | ||
$this->phone = $phone; | ||
return $this; | ||
} | ||
|
||
} |
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,77 @@ | ||
<?php | ||
|
||
namespace AppBundle\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @author Tomáš Linhart <[email protected]> | ||
* | ||
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserAddressRepository") | ||
* @ORM\Table(name="user_address") | ||
*/ | ||
class UserAddress | ||
{ | ||
|
||
/** | ||
* @var int | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @var User | ||
* @ORM\ManyToOne(targetEntity="User") | ||
*/ | ||
private $user; | ||
|
||
/** | ||
* @var Address | ||
* @ORM\ManyToOne(targetEntity="Address") | ||
*/ | ||
private $address; | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getId() { | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @return User | ||
*/ | ||
public function getUser() { | ||
return $this->user; | ||
} | ||
|
||
/** | ||
* @param User $user | ||
* @return self | ||
*/ | ||
public function setUser(User $user) { | ||
$this->user = $user; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return Address | ||
*/ | ||
public function getAddress() | ||
{ | ||
return $this->address; | ||
} | ||
|
||
/** | ||
* @param Address $address | ||
* @return self | ||
*/ | ||
public function setAddress(Address $address) | ||
{ | ||
$this->address = $address; | ||
return $this; | ||
} | ||
|
||
} |
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,9 @@ | ||
<?php | ||
|
||
namespace AppBundle\Repository; | ||
|
||
use Doctrine\ORM\EntityRepository; | ||
|
||
class AddressRepository extends EntityRepository | ||
{ | ||
} |
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,9 @@ | ||
<?php | ||
|
||
namespace AppBundle\Repository; | ||
|
||
use Doctrine\ORM\EntityRepository; | ||
|
||
class UserAddressRepository 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.
zajímavé řešení. :) Neznal jsem :)