mirror of
https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
synced 2025-09-10 03:47:13 +02:00
Added addUser function to repository
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
CREATE TABLE `test_db`.`user` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(45) NULL,
|
||||
`email` VARCHAR(45) NULL,
|
||||
`hash` VARCHAR(45) NULL,
|
||||
`name` VARCHAR(120) NULL,
|
||||
`email` VARCHAR(120) NULL,
|
||||
`hash` VARCHAR(60) NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
|
||||
UNIQUE INDEX `email_UNIQUE` (`email` ASC));
|
||||
|
@@ -2,6 +2,8 @@
|
||||
use core\Core;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use repository\product\Product as ProductRepository;
|
||||
use repository\user\User as UserRepository;
|
||||
use entity\user\User;
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
@@ -44,6 +46,14 @@ foreach ($lines as $number=>$line) {
|
||||
$products->add($product);
|
||||
}
|
||||
|
||||
$productRepository = new ProductRepository((new Core())->getDatabase());
|
||||
$productRepository = new ProductRepository(new Core());
|
||||
$productRepository->addProducts($products);
|
||||
|
||||
echo "Insert dummy user...\n";
|
||||
$user= new User();
|
||||
$user->setName('Maxla Mustermensch');
|
||||
$user->setPasswordHashByPassword('passwort:)');
|
||||
$user->setEmail('test@mail.test');
|
||||
$userRepository = new UserRepository(new Core());
|
||||
$userRepository->addUser($user);
|
||||
?>
|
Reference in New Issue
Block a user