public static loadOneByOwner ( $owner, $owner_id, $owner_attribute ) |
public static function loadOneByOwner($owner, $owner_id, $owner_attribute)
{
$owner = Owners::findOne(['owner' => $owner, 'owner_id' => $owner_id, 'owner_attribute' => $owner_attribute]);
if ($owner) {
return $owner->mediafile;
}
return false;
}
/** * @return bool|Mediafile */ public function getThumbnailModel() { if (!empty($this->thumbnail_model)) { return $this->thumbnail_model; } return $this->thumbnail_model = Mediafile::loadOneByOwner('post', $this->id, 'thumbnail'); }