-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
339 additions
and
9 deletions.
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 |
---|---|---|
|
@@ -28,5 +28,9 @@ APP_SECRET=b714a52506e33cdbe10a883b083c5b54 | |
# | ||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" | ||
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7" | ||
DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8" | ||
POSTGRES_USER=main | ||
POSTGRES_PASSWORD=main | ||
POSTGRES_DB=lottery | ||
POSTGRES_HOST=postgresql | ||
DATABASE_URL="postgresql://main:main@postgresql:5432/lottery?serverVersion=13&charset=utf8" | ||
###< doctrine/doctrine-bundle ### |
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 |
---|---|---|
|
@@ -16,3 +16,5 @@ | |
###< symfony/phpunit-bridge ### | ||
|
||
/logs/* | ||
|
||
.idea |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,4 @@ | ||
app_lucky_number: | ||
path: /lucky/number | ||
controller: App\Controller\LuckyController::number | ||
methods: GET |
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,18 @@ | ||
<?php | ||
|
||
namespace App\Controller; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
|
||
class LuckyController extends AbstractController | ||
{ | ||
public function number(): Response | ||
{ | ||
$number = random_int(0, 100); | ||
|
||
return $this->render('lucky/number.html.twig', [ | ||
'number' => $number, | ||
]); | ||
} | ||
} |
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,115 @@ | ||
<?php | ||
|
||
namespace App\Entity; | ||
|
||
use App\Repository\UserRepository; | ||
use Doctrine\ORM\Mapping as ORM; | ||
use Symfony\Component\Security\Core\User\UserInterface; | ||
|
||
/** | ||
* @ORM\Entity(repositoryClass=UserRepository::class) | ||
* @ORM\Table(name="`user`") | ||
*/ | ||
class User implements UserInterface | ||
{ | ||
/** | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @ORM\Column(type="string", length=180, unique=true) | ||
*/ | ||
private $name; | ||
|
||
/** | ||
* @ORM\Column(type="json") | ||
*/ | ||
private $roles = []; | ||
|
||
/** | ||
* @var string The hashed password | ||
* @ORM\Column(type="string") | ||
*/ | ||
private $password; | ||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getName(): ?string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function setName(string $name): self | ||
{ | ||
$this->name = $name; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* A visual identifier that represents this user. | ||
* | ||
* @see UserInterface | ||
*/ | ||
public function getUsername(): string | ||
{ | ||
return (string) $this->name; | ||
} | ||
|
||
/** | ||
* @see UserInterface | ||
*/ | ||
public function getRoles(): array | ||
{ | ||
$roles = $this->roles; | ||
// guarantee every user at least has ROLE_USER | ||
$roles[] = 'ROLE_USER'; | ||
|
||
return array_unique($roles); | ||
} | ||
|
||
public function setRoles(array $roles): self | ||
{ | ||
$this->roles = $roles; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @see UserInterface | ||
*/ | ||
public function getPassword(): string | ||
{ | ||
return (string) $this->password; | ||
} | ||
|
||
public function setPassword(string $password): self | ||
{ | ||
$this->password = $password; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @see UserInterface | ||
*/ | ||
public function getSalt() | ||
{ | ||
// not needed when using the "bcrypt" algorithm in security.yaml | ||
} | ||
|
||
/** | ||
* @see UserInterface | ||
*/ | ||
public function eraseCredentials() | ||
{ | ||
// If you store any temporary, sensitive data on the user, clear it here | ||
// $this->plainPassword = null; | ||
} | ||
} |
Oops, something went wrong.