/** * Returns an instance of class. * * @return USERCREDITS_BOL_ActionPriceDao */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
/** * Finds action list by type * * @param string $type * @param $accTypeId * @return array */ public function findList($type, $accTypeId) { switch ($type) { case 'earn': $amountCond = ' AND `ap`.`amount` > 0 '; break; case 'lose': $amountCond = ' AND `ap`.`amount` < 0 '; break; default: $amountCond = ' AND `ap`.`amount` = 0 '; break; } $actionPriceDao = USERCREDITS_BOL_ActionPriceDao::getInstance(); $sql = "SELECT `a`.*, `ap`.`amount`, `ap`.`disabled` FROM `" . $this->getTableName() . "` AS `a`\n LEFT JOIN `" . $actionPriceDao->getTableName() . "` AS `ap`\n ON (`a`.`id`=`ap`.`actionId` AND `ap`.`accountTypeId` = :id)\n WHERE `a`.`isHidden` = 0 AND `a`.`active` = 1 " . $amountCond; return $this->dbo->queryForList($sql, array('id' => $accTypeId)); }
/** * @param USERCREDITS_BOL_ActionPrice $ap */ public function updateCreditsActionPrice(USERCREDITS_BOL_ActionPrice $ap) { $this->actionPriceDao->save($ap); }