| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Admin\Product\Data\Validators; |
| 4 |
|
| 5 |
use SyncBasalam\Utilities\ProductMetaKey; |
| 6 |
|
| 7 |
defined('ABSPATH') || exit; |
| 8 |
|
| 9 |
class ImageValidator implements ValidatorInterface |
| 10 |
{ |
| 11 |
public function validate($product): void |
| 12 |
{ |
| 13 |
$basalamProductId = get_post_meta($product->get_id(), ProductMetaKey::basalamProductId(), true); |
| 14 |
|
| 15 |
if (!empty($basalamProductId)) return; |
| 16 |
|
| 17 |
if (!$product->get_image_id()) { |
| 18 |
throw new \InvalidArgumentException('� |
| 19 |
حصول فاقد تصویر است.'); |
| 20 |
} |
| 21 |
} |
| 22 |
} |
| 23 |
|