/** * Get log object based on creation time and creator of the object * * @return org_routamc_positioning_log */ function seek_log_object($person = null, $time = null) { if (is_integer($person) || is_string($person)) { $person_guid = $person; } elseif (is_null($person)) { $person_guid = $this->object->metadata->creator; // TODO: Use metadata.authors? } else { $person_guid = $person->guid; } if (is_null($time)) { $time = $this->object->metadata->published; } $person = new midgard_person($person_guid); $qb = org_routamc_positioning_log::new_query_builder(); $qb->add_constraint('person', '=', $person->id); $qb->add_constraint('date', '<=', $time); $qb->add_order('date', 'DESC'); $qb->set_limit(1); $matches = $qb->execute(); if (count($matches) > 0) { return $matches[0]; } return null; }