'ddw_weekdays', 'primary' => 'id_ddw_weekday', 'multilang' => false, 'fields' => array( 'id_carrier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'id_weekday' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'enabled' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'minmax_enabled' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'min_days' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => false), 'max_days' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => false), 'timeslots_prep_minutes' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => false), 'cutofftime_enabled' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'cutofftime_hours' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'cutofftime_minutes' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'min_days_postcutoff' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'order_limit' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt') ) ); /** * @param $id_carrier * @param $id_weekday * @param $id_shop * @param bool $use_cache * @return bool */ public function loadWeekday($id_carrier, $id_weekday, $id_shop, $use_cache = true) { $cache_id = 'loadWeekday::' . (int)$id_carrier . '-' . (int)$id_weekday . '-' . (int)$id_shop; $cached = false; if (isset(self::$_cache[$cache_id])) { if (is_array(self::$_cache[$cache_id])) { $cached = true; } } if (!$use_cache) { $cached = false; } if (!$cached) { $sql = 'SELECT * FROM ' . _DB_PREFIX_ . self::$definition['table'] . ' WHERE id_carrier=' . (int)$id_carrier . ' AND id_shop = ' . (int)$id_shop . ' AND id_weekday = ' . (int)$id_weekday; $row = DB::getInstance()->getRow($sql); if (!$row) { self::$_cache[$cache_id] = false; return false; } else { $this->hydrate($row); self::$_cache[$cache_id] = $row; } } else { $this->hydrate(self::$_cache[$cache_id]); } } public function getAvailableWeekdaysCollection($id_carrier, $id_shop) { $sql = new DbQuery(); $sql->select('*'); $sql->from('ddw_weekdays'); $sql->where('enabled = 1'); $sql->where('id_carrier = ' . (int)$id_carrier); $sql->where('id_shop = ' . (int)$id_shop); $result = DB::getInstance()->executeS($sql); if (!$result) { return array(); } else { return $this->hydrateCollection('DDWWeekdayModel', $result); } } }