. */ require_once(FILESYSTEMROOTPATH."jc/include/dao/CandidatesDao.php"); class CandidatesService { private $candidatesDao; /** * Default constructor * * @param CandidatesDao */ public function __construct(CandidatesDao $candidatesDao) { $this->candidatesDao = $candidatesDao; } /** * Load a candidate by id * * @param string id of the candidate to be loaded * @return a candidates object */ public function load($id) { return $this->candidatesDao->load($id); } /** * Load candidates by election_id * * @return array of candidates */ public function loadByElection($election_id) { return $this->candidatesDao->loadByElection($election_id); } public function delete($candidate){ return $this->candidatesDao->delete($candidate); } /** * Save or update candidate: * * @param candidate object * @return boolean [success or fail] */ public function saveOrUpdate($candidate){ return $this->candidatesDao->saveOrUpdate($candidate); } } ?>