/** * Fetch Sit which references this Logins. Will return null in case reference is invalid. * `logins`.`sit_id` -> `sit`.`id` * * @param PDO $db a PDO Database instance * @param array $sort array of DSC instances * @return Sit */ public function fetchSit(PDO $db, $sort = null) { $filter = array(Sit::FIELD_ID => $this->getSitId()); $result = Sit::findByFilter($db, $filter, true, $sort); return empty($result) ? null : $result[0]; }
} $overleg = new Overlegbasis(); $overleg->assignDefaultValues(); $overleg->setPatientCode('06/HA-07-331104-O')->setLocatie('Tongeren')->setKeuzeVergoeding(1); //$overleg->insertIntoDatabase($db); $pat = $overleg->fetchPatient($db); foreach ($pat as $p) { // @var $p Patient echo $p->getNaam() . "\t-\t" . $p->getVoornaam() . "\n"; } /* * example to use SIT.class.php */ $sit = Sit::findById($db, '3'); echo $sit->getNaam(); $newSit = new Sit(); $newSit->setNaam('Gent')->setNr(50)->setId(-1); $newSit->insertIntoDatabase($db); $gem = new Gemeente(); $gem->setNaam('Tongeren'); $gems = Gemeente::findByExample($db, $gem); listGem($gems); $sort = array(new DSC(Patient::FIELD_NAAM, DSC::ASC), new DSC(Patient::FIELD_VOORNAAM, DSC::ASC)); /* $example = new Patient(); $example->setSex(0); $patientList = Patient::findByExample($db, $example, true, $sort); listPatients($patientList); function listPatients($patients) { foreach ($patients as $p) { // @var $p Patient
/** * get single Sit instance from a DOMElement * * @param DOMElement $node * @return Sit */ public static function fromDOMElement(DOMElement $node) { $o = new Sit(); $o->assignByHash(self::domNodeToHash($node, self::$FIELD_NAMES, self::$DEFAULT_VALUES, self::$FIELD_TYPES)); $o->notifyPristine(); return $o; }