toArray() as $product) { $statement = $this->database->prepare("INSERT INTO `" . Core::DATABASE_NAME . "`.`" . self::TABLE . "` (`name`, `color`, `price`,`tax`, `image`) VALUES (?, ?, ?,?,?);"); $statement->execute([ $product->getName(), $product->getColor(), $product->getPrice()->getNetto()->getCents(), $product->getPrice()->getTax(), $product->getImage()->getImage(), ]); } } public function getAllProducts(): ArrayCollection { $statement = $this->database->prepare('SELECT * FROM '.self::TABLE.';'); $statement->execute(); foreach ($statement->fetchAll() as $product){ } } static public function createProduct(string $name, string $color, int $cents, int $tax, string $imagePath):ProductEntity{ $product = new ProductEntity(); $product->setName($name); $product->setColor($color); $euro = new Euro(); $euro->setCents($cents); $price = new Price(); $price->setPrice($euro); $price->setTax($tax); $product->setPrice($price); $image = new UrlImage(); $image->setImage($imagePath); $product->setImage($image); return $product; } public function deleteAllProducts(): void {} public function getProductById(int $id): ProductEntityInterface {} }