UserService.php 548 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. class Application_Service_UserService
  3. {
  4. private $currentUser;
  5. public function __construct()
  6. {
  7. $userInfo = Zend_Auth::getInstance()->getStorage()->read();
  8. if (!is_null($userInfo->id)) {
  9. $this->currentUser = CcSubjsQuery::create()->findPK($userInfo->id);
  10. }
  11. }
  12. /**
  13. *
  14. * Returns a CcSubjs object
  15. */
  16. public function getCurrentUser()
  17. {
  18. if (is_null($this->currentUser)) {
  19. throw new Exception();
  20. }
  21. return $this->currentUser;
  22. }
  23. }