public function checkValidity()
{
$sane = true;
if ($this->type == "asset" && !empty($this->id)) {
$el = Asset::getById($this->id);
if (!$el instanceof Asset) {
$sane = false;
Logger::notice("Detected insane relation, removing reference to non existent asset with id [" . $this->id . "]");
$this->id = null;
$this->type = null;
}
}
if (!($poster = Asset::getById($this->poster))) {
$sane = false;
Logger::notice("Detected insane relation, removing reference to non existent asset with id [" . $this->id . "]");
$this->poster = null;
}
return $sane;
}