/** * Get current user object. * * @return sfUser The current user's object, for manual access; returns false if not logged in */ public static function getCurrentUser() { if (!static::isLoggedIn()) { return false; } static::evaluateSession(); if (isset(static::$current_user_object)) { return static::$current_user_object(); } else { static::$current_user_object = sfCore::make('sfUser'); static::$current_user_object->loadByUsername(static::$current_user); return static::$current_user_object; } }
/** * Lazy-loading of parent post, just for when it's necessary. */ public function loadParentPost() { if (isset($this->parent)) { return $this->parent; } $this->parent = sfCore::make('sfBlogPost'); $this->parent->load($this->parent_id); return $this->parent; }