public function save() { $religionId = $this->getValue('religionId'); if (!empty($religionId)) { $religion = $this->getReligionService()->getReligionById($religionId); } else { $religion = new Religion(); } $religion->setCode($this->getValue('code')); $religion->setName($this->getValue('name')); $religion->save(); }
public static function getReligions() { $dados = Database::ReadAll("religion", "*"); if (!$dados) { return ''; } foreach ($dados as $dado) { $religion = new Religion(); $religion->setId($dado['ID_RELIGION']); $religion->setName($dado['NAME_RELIGION']); $religions[] = $religion; } return $religions; }