Skip to content

Commit

Permalink
fix user login retrieve
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoCalmet committed Oct 27, 2020
1 parent 2479342 commit 43b9f2c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
$user = new \stdClass;
$user->email = $_POST['login_email'];
$user->password = $_POST['login_password'];
$logged = new \App\Service\User\Login($user);
var_dump($logged); //test retrieve
$loginRequest = new \App\Service\User\Login();
var_dump($loginRequest->login($user)); //test retrieve
} catch (Exception $ex) {
echo '<script language="javascript">alert("ERROR: ' . $ex->getMessage() . '")</script>';
}
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

final class User
{
/** @var int $id */
/** @var string $id */
private $id;

/** @var string $name */
Expand All @@ -24,7 +24,7 @@ final class User
/** @var string|null $updatedAt */
private $updatedAt;

public function getId(): int
public function getId(): string
{
return $this->id;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/User/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class Login extends Base
{
public function login(object $entity): User
public function login(object $entity): object
{
if (empty($entity->email)) {
throw new UserException('El campo "correo electrónico" es obligatorio.', 400);
Expand Down

0 comments on commit 43b9f2c

Please sign in to comment.