Example #1
0
 /**
  * @param Sag $sag An instantiated copy of Sag that you want this class to
  * use. If you don't specify a database (empty($sag->currentDatabase())) then
  * it will be set to '_users'.
  *
  * @return SagUserUtils
  */
 public function __construct($sag)
 {
     if (!$sag instanceof Sag) {
         throw new SagException('Tried to call setSag() with a non-Sag implementation.');
     }
     //Use the database if they pre-selected it, else default to Couch's default.
     $db = $sag->currentDatabase();
     if (empty($db)) {
         $sag->setDatabase('_users');
     }
     $this->sag = $sag;
 }