/** * ProductOption constructor. * @param int $id * @param Product $product * @param Option $option * @param Option $parentOption * @param bool $required * @param int $afcId * @param bool $loadValues Defines whether option values should be loaded from DB or not */ public function __construct($id, $product, $option, $parentOption, $required, $afcId, $loadValues = true) { $this->id = $id; $this->product = $product; $this->option = $option; $this->parentOption = $parentOption; $this->required = $required; $this->afcId = $afcId; if ($loadValues) { $this->value = ProductDAO::getInstance()->getProductOptionValues($this); } else { if ($this->getOption()->isMultiValueType()) { $this->value = new ProductOptionValueCollection(); } } }