$value) { if (object_property_exists($this, $field)) { $this->$field = $value; } } } public static function find(array $criteria) { global $DB; $record = $DB->get_record(LABNBOOK_TABLE, $criteria, '*'); return new self($record); } }