diff --git a/CMD.md b/CMD.md index 281741e..d97c58c 100644 --- a/CMD.md +++ b/CMD.md @@ -1,19 +1,23 @@ +### Créer la DB : +```bash +sudo docker exec -it booknest-php-1 php bin/console doctrine:schema:create``` + ### Mettre à jour la bdd : ```bash -sudo docker exec -it cloudsprint-php-1 php bin/console doctrine:schema:update --force +sudo docker exec -it booknest-php-1 php bin/console doctrine:schema:update --force ``` ### Créer une entity avec interaction : ```bash -sudo docker exec -it cloudsprint-php-1 php bin/console make:entity User +sudo docker exec -it booknest-php-1 php bin/console make:entity User ``` ### Créer un controller : ```bash -sudo docker exec -it cloudsprint-php-1 php bin/console make:controller name +sudo docker exec -it booknest-php-1 php bin/console make:controller name ``` ### Vider le cache : ```bash -sudo docker exec -it cloudsprint-php-1 php bin/console cache:clear +sudo docker exec -it booknest-php-1 php bin/console cache:clear ``` diff --git a/src/Entity/User.php b/src/Entity/User.php new file mode 100644 index 0000000..30dbd37 --- /dev/null +++ b/src/Entity/User.php @@ -0,0 +1,95 @@ +id; + } + + public function getEmail(): ?string + { + return $this->email; + } + + public function setEmail(string $email): static + { + $this->email = $email; + + return $this; + } + + public function getPseudo(): ?string + { + return $this->pseudo; + } + + public function setPseudo(string $pseudo): static + { + $this->pseudo = $pseudo; + + return $this; + } + + public function getPassword(): ?string + { + return $this->password; + } + + public function setPassword(string $password): static + { + $this->password = $password; + + return $this; + } + + public function getFirstName(): ?string + { + return $this->firstName; + } + + public function setFirstName(string $firstName): static + { + $this->firstName = $firstName; + + return $this; + } + + public function getLastName(): ?string + { + return $this->lastName; + } + + public function setLastName(string $lastName): static + { + $this->lastName = $lastName; + + return $this; + } +} diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php new file mode 100644 index 0000000..3767526 --- /dev/null +++ b/src/Repository/UserRepository.php @@ -0,0 +1,48 @@ + + * + * @method User|null find($id, $lockMode = null, $lockVersion = null) + * @method User|null findOneBy(array $criteria, array $orderBy = null) + * @method User[] findAll() + * @method User[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class UserRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, User::class); + } + +// /** +// * @return User[] Returns an array of User objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('u.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?User +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +}