/** * @see \wcf\data\DatabaseObject::__construct() */ public function __construct($categoryID, $row = null, UserOptionCategory $category = null) { if ($categoryID !== null) { $sql = "SELECT\toption_category.*,\n\t\t\t\t\t(SELECT COUNT(DISTINCT optionName) FROM wcf" . WCF_N . "_user_option WHERE categoryName = option_category.categoryName) AS options\n\t\t\t\tFROM\twcf" . WCF_N . "_user_option_category option_category\n\t\t\t\tWHERE\toption_category.categoryID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($categoryID)); $row = $statement->fetchArray(); } parent::__construct(null, $row, $category); }
public function __construct($id, array $row = null, DatabaseObject $object = null) { parent::__construct($id, $row, $object); $this->type = \wcf\system\jcoins\shop\ShopHandler::getInstance()->getItemTypeByID($this->itemType); $condition = new \wcf\system\database\util\PreparedStatementConditionBuilder(); $condition->add('itemID = ?', array($this->getObjectID())); $condition->add('parameterID IN (?)', array(array_map(function ($value) { return $value['parameterID']; }, $this->type->getParameters()))); $sql = "SELECT * FROM wcf" . WCF_N . "_jcoins_shop_item_parameter " . $condition; $stmt = \wcf\system\WCF::getDB()->prepareStatement($sql); $stmt->execute($condition->getParameters()); while ($row = $stmt->fetchArray()) { $this->parameters[$row['parameterID']] = $row['value']; } }