Object::loadPublishedModel PHP Method

loadPublishedModel() public static method

Load Object that has been published and time is <= time()
public static loadPublishedModel ( type $id ) : type
$id type
return type
    public static function loadPublishedModel($id)
    {
        $model = Object::model()->findByPk((int) $id);
        if ($model === null) {
            throw new CHttpException(404, 'The requested page does not exist.');
        } else {
            if ($model->object_status == ConstantDefine::OBJECT_STATUS_PUBLISHED && $model->object_date <= time()) {
                return $model;
            } else {
                throw new CHttpException(404, 'The requested page does not exist.');
            }
        }
    }