public function loadByUserAndSite(UserAccountModel $user, SiteModel $site) { global $DB; $stat = $DB->prepare("SELECT user_watches_site_information.* FROM user_watches_site_information WHERE user_account_id =:user_account_id AND site_id=:site_id"); $stat->execute(array('user_account_id' => $user->getId(), 'site_id' => $site->getId())); if ($stat->rowCount() > 0) { $uws = new UserWatchesSiteModel(); $uws->setFromDataBaseRow($stat->fetch()); return $uws; } }
public function fetchAll() { $this->buildStart(); $this->build(); $this->buildStat(); $results = array(); while ($data = $this->stat->fetch()) { $uwsm = new UserWatchesSiteModel(); $uwsm->setFromDataBaseRow($data); $results[] = $uwsm; } return $results; }