шаг 3 завершен
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
final class ProductVariantRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
public function publishedForProduct(int $productId): array
|
||||
{
|
||||
$statement = $this->pdo()->prepare(
|
||||
'SELECT id, product_id, name, unit, package_quantity, step_quantity, price_per_unit, package_price, is_default
|
||||
FROM product_variants
|
||||
WHERE product_id = :product_id
|
||||
AND is_published = 1
|
||||
AND is_available = 1
|
||||
ORDER BY is_default DESC, sort_order, id'
|
||||
);
|
||||
|
||||
$statement->execute(['product_id' => $productId]);
|
||||
|
||||
return $statement->fetchAll();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user