From c4aa5cdb5e90ad4b420e22772797d16980232a2b Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 15 Apr 2026 18:38:55 +0000
Subject: [PATCH] =Updating custom tables to utilize CustomTable.php

---
 inc/managers/SEO/render/Traits/_Properties/openingHoursSpecificationTrait.php |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/inc/managers/SEO/render/Traits/_Properties/openingHoursSpecificationTrait.php b/inc/managers/SEO/render/Traits/_Properties/openingHoursSpecificationTrait.php
index 94f601c..f9aba4a 100644
--- a/inc/managers/SEO/render/Traits/_Properties/openingHoursSpecificationTrait.php
+++ b/inc/managers/SEO/render/Traits/_Properties/openingHoursSpecificationTrait.php
@@ -1,23 +1,43 @@
 <?php
 namespace JVBase\managers\SEO\render\Traits\_Properties;
 
+use JVBase\base\SchemaHelper;
 use JVBase\managers\SEO\render\Thing\Intangible\StructuredValue\OpeningHoursSpecification;
+use JVBase\managers\SEO\render\Traits\_Helpers\arrayHelper;
 
 if (!defined('ABSPATH')) {
 	exit;
 }
 trait openingHoursSpecificationTrait {
+	use arrayHelper;
 	/**
-	 * @var OpeningHoursSpecification The opening hours of a certain place.
+	 * @var OpeningHoursSpecification|array The opening hours of a certain place.
 	 */
-	protected OpeningHoursSpecification $openingHoursSpecification;
+	protected OpeningHoursSpecification|array $openingHoursSpecification;
 
-	public function getOpeningHoursSpecification():?OpeningHoursSpecification
+	public function getOpeningHoursSpecification():OpeningHoursSpecification|array|null
 	{
 		return $this->openingHoursSpecification??null;
 	}
-	public function setOpeningHoursSpecification(OpeningHoursSpecification $openingHoursSpecification):void
+	public function setOpeningHoursSpecification(OpeningHoursSpecification|array $openingHoursSpecification):void
 	{
+		if (is_array($openingHoursSpecification)) {
+			if (array_key_exists('dayOfWeek', $openingHoursSpecification)) {
+				if (!array_key_exists('type', $openingHoursSpecification)) {
+					$openingHoursSpecification['type'] = 'JVBase\managers\SEO\render\Thing\Intangible\StructuredValue\OpeningHoursSpecification';
+				}
+				$openingHoursSpecification = SchemaHelper::classFromConfig($openingHoursSpecification);
+			} else {
+				$out = [];
+				foreach ($openingHoursSpecification as $hours) {
+					if (!array_key_exists('type', $hours)){
+						$hours['type'] = 'JVBase\managers\SEO\render\Thing\Intangible\StructuredValue\OpeningHoursSpecification';
+					}
+					$out[] = SchemaHelper::classFromConfig($hours);
+				}
+				$openingHoursSpecification = $out;
+			}
+		}
 		$this->openingHoursSpecification = $openingHoursSpecification;
 	}
 

--
Gitblit v1.10.0