/**
  * @see \wcf\system\cache\AbstractCacheBuilder::rebuild()
  */
 public function rebuild(array $parameters)
 {
     $data = array();
     $conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder();
     // get all post templates
     $sql = 'SELECT questionID, answerID 
   FROM wbb' . WCF_N . '_post_butler_answer post_butler_answer
   ' . $conditionBuilder;
     $statement = \wcf\system\WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditionBuilder->getParameters());
     while ($row = $statement->fetchArray()) {
         $data[$row['questionID']][$row['answerID']] = \wbb\data\post\butler\answer\ViewableAnswer::getViewableAnswerByID($row['answerID']);
     }
     return $data;
 }
Пример #2
0
 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'];
     }
 }