Development

Changeset 9428 for plugins/sfDoctrineUserPlugin

You must first sign up to be able to contribute.

Show
Ignore:
Timestamp:
06/05/08 04:30:33 (5 years ago)
Author:
subzero2000
Message:

Fix to ensure sfContext actually has an instance by calling sfContext::hasInstance() prior to sfContext::getInstance().
symfony 1.1 throws an exception from within sfContext::getInstance() if the instance hasn't been instantiated yet, which is a change in behavior from symfony 1.0.
This fix is compatible with both symfony 1.0 and symfony 1.1.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfDoctrineUserPlugin/branches/1.0/lib/Template/Listener/Rankable.php

    r8067 r9428  
    9090    public function getCurrentUser() 
    9191    { 
    92        return ( sfContext::getInstance()->getUser()->getUser() !== false) ? sfContext::getInstance()->getUser()->getUser() : null
     92       return (sfContext::hasInstance() && sfContext::getInstance()->getUser()->getUser() !== false) ? sfContext::getInstance()->getUser()->getUser() : null
    9393    } 
    9494} 
  • plugins/sfDoctrineUserPlugin/branches/1.0/lib/Template/Listener/Userstampable.php

    r8631 r9428  
    8989    public function getCurrentUser() 
    9090    { 
    91       $user = isset(sfContext::getInstance()->getUser()->getUser()->User) ? sfContext::getInstance()->getUser()->getUser()->User : null; 
     91      $user = (sfContext::hasInstance() && isset(sfContext::getInstance()->getUser()->getUser()->User)) ? sfContext::getInstance()->getUser()->getUser()->User : null; 
    9292       return $user ; 
    9393    }