/** * Returns an instance of class (singleton pattern implementation). * * @return BOL_VoteDao */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
/** * @param string $entityType */ public function deleteByEntityType($entityType) { $this->voteDao->deleteByEntityType($entityType); }
/** * Gets all votes for provided entity type and list of entity id * * @param array<int> $idList * @param string $entityType * @return array<BOL_Vote> */ public function getEntityTypeVotes(array $idList, $entityType) { if (empty($idList) || empty($entityType)) { return array(); } $example = new OW_Example(); $example->andFieldEqual(BOL_VoteDao::ENTITY_TYPE, $entityType); $example->andFieldInArray(BOL_VoteDao::ENTITY_ID, $idList); $example->andFieldEqual(BOL_VoteDao::ACTIVE, 1); return BOL_VoteDao::getInstance()->findListByExample($example); }